#!/usr/bin/env bash # Push hf_prebackbone_demo to https://huggingface.co/spaces/vinayedula/RefDiffNet set -euo pipefail cd "$(dirname "$0")" SPACE_REMOTE="${SPACE_REMOTE:-https://huggingface.co/spaces/vinayedula/RefDiffNet}" if [[ ! -f weights/prebackbone_a11_ca.pt ]]; then echo "Run: python extract_prebackbone_weights.py --ckpt /path/to/best.pt" exit 1 fi git init git lfs install 2>/dev/null || true git add \ app.py \ prebackbone_infer.py \ extract_prebackbone_weights.py \ deploy_to_refdiffnet.sh \ prepare_space.sh \ requirements.txt \ setup.sh \ README.md \ .gitattributes \ .gitignore \ vendor/ \ examples/ \ weights/prebackbone_a11_ca.pt # Commit only if there are staged changes if ! git diff --cached --quiet; then git commit -m "RefDiffNet: A11_CA prebackbone enrichment demo" elif ! git rev-parse HEAD >/dev/null 2>&1; then echo "ERROR: No commit to push. Check git add / files." exit 1 else echo "No new changes; pushing existing commit." fi # HF Spaces use 'main' (git init often creates 'master') git branch -M main if git remote get-url origin &>/dev/null; then git remote set-url origin "${SPACE_REMOTE}" else git remote add origin "${SPACE_REMOTE}" fi echo "Pushing branch 'main' to ${SPACE_REMOTE}" echo "HF token as password: https://huggingface.co/settings/tokens" git push -u origin main