handship / scripts /deploy-hf.sh
ImTamsi's picture
feat(handship-hf): migrate to Gradio SDK + ZeroGPU
70edcda
Raw
History Blame Contribute Delete
965 Bytes
#!/usr/bin/env bash
# Deploy HandShip HF Space via git push or hf upload.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
HF_USER="${HF_USER:-ImTamsi}"
SPACE_ID="${HF_USER}/handship"
REMOTE="https://huggingface.co/spaces/${SPACE_ID}"
if ! hf auth whoami >/dev/null 2>&1; then
echo "Not logged in to Hugging Face."
echo "Run: hf auth login --add-to-git-credential"
echo "Token: https://huggingface.co/settings/tokens (write access)"
exit 1
fi
echo "Deploying to ${SPACE_ID}…"
if ! hf repos create "${SPACE_ID}" --type space --space-sdk gradio --no-private --exist-ok; then
echo "Could not create Space (may already exist — continuing)."
fi
if git remote get-url origin >/dev/null 2>&1; then
git remote set-url origin "${REMOTE}"
else
git remote add origin "${REMOTE}"
fi
git push -u origin main
echo ""
echo "Space URL: https://huggingface.co/spaces/${SPACE_ID}"
echo "Build logs: hf spaces logs ${SPACE_ID} --follow"