Spaces:
Running
Running
Download server_entry.py from Ashketchum007/Code-demo: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/spaces/Ashketchum007/Code-demo/resolve/main/server_entry.py
- Command line
-
hf download hf://spaces/Ashketchum007/Code-demo/server_entry.py
-
curl -L -o server_entry.py https://huggingface.co/spaces/Ashketchum007/Code-demo/resolve/main/server_entry.py
476 Bytes
| """Console entrypoint expected by openenv validate. | |
| Provides a `server` script that runs uvicorn for `server:app` on port 7860. | |
| """ | |
| from __future__ import annotations | |
| import os | |
| from typing import NoReturn | |
| import uvicorn | |
| def main() -> NoReturn: | |
| """Run the FastAPI app using uvicorn on the mandated port.""" | |
| host = os.getenv("HOST", "0.0.0.0") | |
| port = int(os.getenv("PORT", "7860")) | |
| uvicorn.run("server:app", host=host, port=port) | |
| raise SystemExit(0) | |