File size: 969 Bytes
f32a4be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63d67f0
 
f32a4be
 
 
 
 
 
 
 
 
 
 
63d67f0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
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()