Spaces:
Running on Zero
Running on Zero
Download server/main.py from drinkmoonshine/parallel-constrained-decoding: direct link, hf CLI and curl.
- Browser
- Download file 530 Bytes
-
https://huggingface.co/spaces/drinkmoonshine/parallel-constrained-decoding/resolve/main/server/main.py
- Command line
-
hf download hf://spaces/drinkmoonshine/parallel-constrained-decoding/server/main.py
-
curl -L -o main.py https://huggingface.co/spaces/drinkmoonshine/parallel-constrained-decoding/resolve/main/server/main.py
530 Bytes
| """ | |
| Entry point to run the FastAPI server persistently. | |
| """ | |
| import sys | |
| import os | |
| import uvicorn | |
| # Ensure project root is in PYTHONPATH | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| if __name__ == "__main__": | |
| host = os.environ.get("HOST", "0.0.0.0" if "SPACE_ID" in os.environ else "127.0.0.1") | |
| port = int(os.environ.get("PORT", 7860 if "SPACE_ID" in os.environ else 8000)) | |
| uvicorn.run( | |
| "server.app:app", | |
| host=host, | |
| port=port, | |
| log_level="info" | |
| ) | |