Download server.py from simikkk/EtsyListingGenerator: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/spaces/simikkk/EtsyListingGenerator/resolve/main/server.py
- Command line
-
hf download hf://spaces/simikkk/EtsyListingGenerator/server.py
-
curl -L -o server.py https://huggingface.co/spaces/simikkk/EtsyListingGenerator/resolve/main/server.py
907 Bytes
| """ | |
| Entry point for Hugging Face Spaces running the **Gradio SDK** (free CPU | |
| basic tier, no Docker needed). | |
| Why this file exists instead of just `app.py`: the project already has a | |
| package called `app/` (all the FastAPI/business logic lives there). Python | |
| can't have a module `app.py` and a package `app/` in the same directory, so | |
| this file is named `server.py` instead, and the Space is configured (via the | |
| `app_file: server.py` line in README.md's metadata block) to run this file. | |
| It imports the fully-wired FastAPI app (with the Gradio UI already mounted | |
| onto it in app/main.py) and serves it with uvicorn on port 7860, which is | |
| the port Hugging Face Spaces expects regardless of which SDK you pick. | |
| """ | |
| import os | |
| import uvicorn | |
| from app.main import app as fastapi_app | |
| if __name__ == "__main__": | |
| port = int(os.environ.get("PORT", 7860)) | |
| uvicorn.run(fastapi_app, host="0.0.0.0", port=port) | |