Spaces:
Running
Running
| """OpenEnv-compatible FastAPI app export.""" | |
| from __future__ import annotations | |
| import os | |
| import sys | |
| from pathlib import Path | |
| BACKEND_DIR = Path(__file__).resolve().parents[1] / "backend" | |
| if str(BACKEND_DIR) not in sys.path: | |
| sys.path.insert(0, str(BACKEND_DIR)) | |
| from app.main import app # noqa: E402,F401 | |
| def main() -> None: | |
| """Run the FastAPI app for OpenEnv multi-mode validation.""" | |
| import uvicorn | |
| host = os.getenv("HOST", "0.0.0.0") | |
| port = int(os.getenv("PORT", "7860")) | |
| uvicorn.run("server.app:app", host=host, port=port) | |
| if __name__ == "__main__": | |
| main() | |