Spaces:
Sleeping
Sleeping
Download server/app.py from Fugeleon9431/Inventory_Optimization: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/spaces/Fugeleon9431/Inventory_Optimization/resolve/main/server/app.py
- Command line
-
hf download hf://spaces/Fugeleon9431/Inventory_Optimization/server/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Fugeleon9431/Inventory_Optimization/resolve/main/server/app.py
813 Bytes
| """ | |
| server/app.py — required entry point for multi-mode deployment. | |
| This module re-exports the FastAPI+Gradio app and provides the `main()` | |
| callable referenced by [project.scripts] → server = "server.app:main". | |
| """ | |
| import os | |
| import sys | |
| # Ensure the project root is on sys.path so all relative imports resolve. | |
| _ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| if _ROOT not in sys.path: | |
| sys.path.insert(0, _ROOT) | |
| import uvicorn | |
| from app import app # noqa: F401 — re-export for `from server.app import app` | |
| def main() -> None: | |
| """Entry point invoked by `uv run server` or `python -m server.app`.""" | |
| uvicorn.run( | |
| "app:app", | |
| host="0.0.0.0", | |
| port=int(os.environ.get("PORT", 7860)), | |
| reload=False, | |
| ) | |
| if __name__ == "__main__": | |
| main() | |