Spaces:
Sleeping
Sleeping
Download app.py from AfanR/BackendBooki: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/AfanR/BackendBooki/resolve/main/app.py
- Command line
-
hf download hf://spaces/AfanR/BackendBooki/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AfanR/BackendBooki/resolve/main/app.py
712 Bytes
| #!/usr/bin/env python | |
| """ | |
| Entry point for running the API on Hugging Face Spaces. | |
| Wraps the Flask WSGI app with an ASGI interface to enable deployment | |
| with uvicorn (ASGI server) on Hugging Face Spaces on port 7860. | |
| """ | |
| from pathlib import Path | |
| import sys | |
| from asgiref.wsgi import WsgiToAsgi | |
| # Add project root to path to ensure imports work | |
| sys.path.insert(0, str(Path(__file__).resolve().parent)) | |
| from api.app import create_app | |
| # Create the WSGI application | |
| app = create_app() | |
| # Wrap the Flask WSGI app with ASGI interface | |
| asgi_app = WsgiToAsgi(app) | |
| if __name__ == "__main__": | |
| import uvicorn | |
| # HF Spaces expects port 7860 | |
| uvicorn.run("app:asgi_app", host="0.0.0.0", port=7860, reload=False) | |