Spaces:
Running
Running
Hugging Face Space Deployment
Target
- Space:
XiaoBai1221/Bloom_Ware - URL:
https://hf.co/spaces/XiaoBai1221/Bloom_Ware - SDK:
docker - App port:
7860
Runtime Shape
- API server:
FastAPI - Entry point:
app.py - Main frontend:
static/frontend - Login frontend build output:
bloom-ware-login/out
app.py 會掛載:
/static->static/frontend/login->bloom-ware-login/out
因此 Docker image 在 build 階段必須先完成 bloom-ware-login 的 npm run build。
Deployment Files
README.md- Hugging Face Space metadata
- deployment quickstart
Dockerfile- Python runtime
- Node.js build for
bloom-ware-login uvicornstartup command
.dockerignore- exclude local secrets, tests, git metadata, temporary files
requirements.txt- runtime dependencies only
requirements-dev.txt- local test dependencies
Secret Handling
不要把以下內容提交到 repo,也不要讓它們進入 Docker build context:
.env.env.*config.json- Firebase service account JSON
- Google speech service account JSON
Hugging Face Space 內請改用 Settings -> Secrets 設定。
Push Flow
既有 remote 已對到 Hugging Face:
git remote -v
應看到:
hf https://huggingface.co/spaces/XiaoBai1221/Bloom_Ware
推送流程:
git add README.md Dockerfile .dockerignore requirements.txt requirements-dev.txt docs/huggingface-space-deployment.md
git commit -m "Prepare Bloom Ware for Hugging Face Space deployment"
git push hf main
若出現驗證提示:
- username:
XiaoBai1221 - password: Hugging Face User Access Token
Verification Checklist
README.mdYAML 包含sdk: dockerREADME.mdYAML 包含app_port: 7860.dockerignore已排除.env與憑證 JSONbloom-ware-login/package-lock.json存在,Dockerfile可用npm ciapp.py仍以${PORT:-7860}啟動- Space Secrets 已補齊
Known Risks
- BM runtime 依賴
torch、torchaudio、speechbrain、transformers,Docker build 仍偏重,首次 build 會慢。 - 若
bloom-ware-login的 Next.js 輸出策略改變,需同步確認app.py掛載的bloom-ware-login/out是否仍存在。 - 若 Space secrets 缺漏,build 會過,但 runtime 可能在啟動後才報錯。