File size: 1,526 Bytes
16760fa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # Deploying the Toaster web demo
The web server is a plain FastAPI app, packaged as a small Docker image
(`Dockerfile` at the repo root β no PySide6/pywebview, ~600 MB). The **same
image** runs on any container host, so you are not locked into one provider.
```bash
docker build -t toaster-demo .
docker run -p 7860:7860 toaster-demo # http://127.0.0.1:7860
```
## Hugging Face Spaces (simplest, free)
1. Create a new Space β **SDK: Docker** (blank).
2. Give its README this frontmatter (top of the Space's `README.md`):
```yaml
---
title: Toaster Demo
emoji: π
colorFrom: red
colorTo: gray
sdk: docker
app_port: 7860
pinned: false
---
```
(Or skip it and set the app port to **7860** in the Space settings.)
3. Push this repo to the Space's git remote:
```bash
git remote add space https://huggingface.co/spaces/<user>/toaster-demo
git push space HEAD:main
```
HF builds the `Dockerfile` and serves the app. Free Spaces sleep after
inactivity and wake on the next visit (~30 s).
## Other hosts (same Dockerfile)
- **Render** β New β Web Service β from repo β "Docker"; it auto-detects the
Dockerfile. Set the port to 7860 (or rely on `$PORT`).
- **Fly.io** β `fly launch` (detects the Dockerfile), then `fly deploy`.
- **Google Cloud Run** β `gcloud run deploy toaster-demo --source . --port 7860`.
- **Any VPS** β `docker run -p 80:7860 toaster-demo`.
The server reads `$PORT` (defaults to 7860) and opens
`examples/sample.bin` on startup.
|