Download scripts/deploy_space.sh from nezuhub/numvault: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/nezuhub/numvault/resolve/main/scripts/deploy_space.sh
- Command line
-
hf download hf://spaces/nezuhub/numvault/scripts/deploy_space.sh
-
curl -L -o deploy_space.sh https://huggingface.co/spaces/nezuhub/numvault/resolve/main/scripts/deploy_space.sh
1.64 kB
| # Deploy NumberVault to a Hugging Face Docker-less Gradio Space on CPU. | |
| # | |
| # Required environment: | |
| # HF_TOKEN Hugging Face access token with write access | |
| # ADMIN_PASSWORD Dashboard password (>= 10 chars) | |
| # Optional: | |
| # SPACE_ID default: nezuhub/number-vault | |
| # BUCKET_ID default: nezuhub/numbervault-storage | |
| # TELEGRAM_BOT_TOKEN, ADMIN_TELEGRAM_IDS, ADMIN_CHAT_ID, PAYMENT_UPI | |
| set -euo pipefail | |
| SPACE_ID="${SPACE_ID:-nezuhub/number-vault}" | |
| BUCKET_ID="${BUCKET_ID:-nezuhub/numbervault-storage}" | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| : "${HF_TOKEN:?Set HF_TOKEN}" | |
| : "${ADMIN_PASSWORD:?Set ADMIN_PASSWORD (>=10 chars)}" | |
| hf repos create "$SPACE_ID" --type space --sdk gradio --flavor cpu-basic \ | |
| --exist-ok --private | |
| hf spaces volumes set "$SPACE_ID" -v "hf://buckets/${BUCKET_ID}:/data" | |
| SECRETS=("ADMIN_PASSWORD=${ADMIN_PASSWORD}") | |
| for name in TELEGRAM_BOT_TOKEN ADMIN_TELEGRAM_IDS ADMIN_CHAT_ID PAYMENT_UPI; do | |
| if [[ -n "${!name:-}" ]]; then | |
| SECRETS+=("${name}=${!name}") | |
| fi | |
| done | |
| hf spaces secrets set "$SPACE_ID" "${SECRETS[@]}" | |
| hf spaces variables set "$SPACE_ID" \ | |
| ENV=production \ | |
| DATA_DIR=/tmp/numbervault \ | |
| BUCKET_MOUNT=/data \ | |
| BUCKET_ENABLED=auto \ | |
| CURRENCY=INR \ | |
| TIMEZONE=Asia/Kolkata | |
| hf upload "$SPACE_ID" "$ROOT" . \ | |
| --exclude ".venv/**" --exclude ".git/**" --exclude ".env" \ | |
| --exclude "**/__pycache__/**" --exclude ".pytest_cache/**" \ | |
| --exclude "*.db" --exclude "*.db-wal" --exclude "*.db-shm" | |
| hf spaces wait "$SPACE_ID" | |
| echo "Space: https://huggingface.co/spaces/${SPACE_ID}" | |
| echo "Health: https://${SPACE_ID/\//-}.hf.space/health" | |