Spaces:
Sleeping
Sleeping
Download server/app.py from ar9av/sql-agent-openenv: direct link, hf CLI and curl.
- Browser
- Download file 969 Bytes
-
https://huggingface.co/spaces/ar9av/sql-agent-openenv/resolve/main/server/app.py
- Command line
-
hf download hf://spaces/ar9av/sql-agent-openenv/server/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ar9av/sql-agent-openenv/resolve/main/server/app.py
969 Bytes
| """ | |
| server/app.py — Self-Improving SQL Agent | |
| ========================================= | |
| Entry point for multi-mode deployment (uv / pyproject.toml). | |
| Adds the backend directory to sys.path so all backend modules are importable, | |
| then re-exports the FastAPI application as `app`. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| # Make backend modules importable when running from repo root | |
| _BACKEND = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "backend") | |
| if _BACKEND not in sys.path: | |
| sys.path.insert(0, _BACKEND) | |
| from main import app # noqa: E402 (FastAPI application) | |
| def main() -> None: | |
| """Entry point for `[project.scripts] server = 'server.app:main'`.""" | |
| import uvicorn | |
| port = int(os.environ.get("PORT", os.environ.get("GRADIO_SERVER_PORT", "7860"))) | |
| uvicorn.run( | |
| "server.app:app", | |
| host="0.0.0.0", | |
| port=port, | |
| log_level="info", | |
| ) | |
| if __name__ == "__main__": | |
| main() | |