Spaces:
Paused
Paused
| # Deploy FoundationPose to Hugging Face Spaces | |
| set -e | |
| SPACE_URL="https://huggingface.co/spaces/gpue/foundationpose" | |
| echo "==========================================" | |
| echo "FoundationPose Hugging Face Deployment" | |
| echo "==========================================" | |
| echo "" | |
| # Check if we're in the right directory | |
| if [ ! -f "app.py" ]; then | |
| echo "Error: Must run from foundationpose directory" | |
| exit 1 | |
| fi | |
| # Check git remote | |
| if ! git remote get-url origin | grep -q "huggingface"; then | |
| echo "Setting up Hugging Face remote..." | |
| git remote add origin https://huggingface.co/spaces/gpue/foundationpose | |
| else | |
| echo "✓ Hugging Face remote configured" | |
| fi | |
| # Check for uncommitted changes | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "" | |
| echo "Uncommitted changes found. Commit them?" | |
| echo "" | |
| git status --short | |
| echo "" | |
| read -p "Commit all changes? (y/N) " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| read -p "Commit message: " commit_msg | |
| git add . | |
| git commit -m "$commit_msg" | |
| else | |
| echo "Deployment cancelled." | |
| exit 0 | |
| fi | |
| fi | |
| # Check for model weights | |
| echo "" | |
| echo "Checking for model weights..." | |
| if [ -d "weights/2023-10-28-18-33-37" ] && [ -d "weights/2024-01-11-20-02-45" ]; then | |
| echo "✓ Model weights found" | |
| echo "" | |
| echo "Deploy in REAL mode (with model weights)?" | |
| echo " - Pro: Actual pose estimation" | |
| echo " - Con: Large files, GPU costs" | |
| echo "" | |
| read -p "Enable real mode? (y/N) " -n 1 -r | |
| echo | |
| if [[ $REPLY =~ ^[Yy]$ ]]; then | |
| USE_REAL="true" | |
| echo "" | |
| echo "Note: Make sure git-lfs is set up for weights:" | |
| echo " git lfs track 'weights/**'" | |
| echo " git add .gitattributes" | |
| echo "" | |
| else | |
| USE_REAL="false" | |
| fi | |
| else | |
| echo "⚠ Model weights not found in weights/" | |
| echo "Deploying in PLACEHOLDER mode (empty results)" | |
| echo "" | |
| echo "To add weights:" | |
| echo " 1. Download from: https://drive.google.com/drive/folders/1GCyGE-LbFGgRC-FuGsF3a1zeBuzsQ1Da" | |
| echo " 2. Extract to weights/ directory" | |
| echo " 3. Re-run this script" | |
| echo "" | |
| USE_REAL="false" | |
| fi | |
| # Push to Hugging Face | |
| echo "Pushing to Hugging Face Spaces..." | |
| git push origin main | |
| echo "" | |
| echo "==========================================" | |
| echo "Deployment Complete!" | |
| echo "==========================================" | |
| echo "" | |
| echo "Your Space is available at:" | |
| echo " $SPACE_URL" | |
| echo "" | |
| echo "Mode: $([ "$USE_REAL" = "true" ] && echo "🟢 Real FoundationPose" || echo "🟡 Placeholder")" | |
| echo "" | |
| if [ "$USE_REAL" = "false" ]; then | |
| echo "To enable real mode:" | |
| echo " 1. Add model weights to weights/ directory" | |
| echo " 2. Set USE_REAL_MODEL=true in Space secrets" | |
| echo " 3. Push again" | |
| echo "" | |
| fi | |
| echo "Monitor build progress:" | |
| echo " https://huggingface.co/spaces/gpue/foundationpose/logs" | |
| echo "" | |
| echo "Test the Space:" | |
| echo " open $SPACE_URL" | |
| echo "" | |