Spaces:
Runtime error
Runtime error
File size: 2,033 Bytes
719e71f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | #!/bin/bash
# Deployment script for Hugging Face Spaces
set -e
echo "π Hugging Face Spaces Deployment Script"
echo "========================================="
echo ""
# Check if git is initialized
if [ ! -d ".git" ]; then
echo "β Error: Not a git repository. Initialize with 'git init' first."
exit 1
fi
# Get repository name
read -p "π Enter your Hugging Face Space name (e.g., username/colorspaces): " SPACE_NAME
if [ -z "$SPACE_NAME" ]; then
echo "β Error: Space name cannot be empty."
exit 1
fi
# Construct the URL
SPACE_URL="https://huggingface.co/spaces/${SPACE_NAME}"
echo ""
echo "π Checking if remote exists..."
# Check if 'hf' remote already exists
if git remote | grep -q "hf"; then
echo "β
Remote 'hf' already exists. Updating URL..."
git remote set-url hf "$SPACE_URL"
else
echo "β Adding remote 'hf'..."
git remote add hf "$SPACE_URL"
fi
echo ""
echo "π¦ Committing changes..."
# Add all files
git add .
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "βΉοΈ No changes to commit."
else
read -p "π¬ Enter commit message (default: 'Update colorspace demo'): " COMMIT_MSG
COMMIT_MSG=${COMMIT_MSG:-"Update colorspace demo"}
git commit -m "$COMMIT_MSG"
echo "β
Changes committed"
fi
echo ""
echo "π’ Pushing to Hugging Face Spaces..."
echo "This may take a few moments..."
echo ""
# Push to HF
if git push hf main; then
echo ""
echo "β
Deployment successful!"
echo ""
echo "π Your Space will be available at:"
echo " $SPACE_URL"
echo ""
echo "β³ Note: It may take a few minutes for the Space to build and start."
echo " You can check the status with: make status"
else
echo ""
echo "β Deployment failed!"
echo ""
echo "Common issues:"
echo " 1. Make sure you're logged in with: huggingface-cli login"
echo " 2. Verify the Space exists on Hugging Face"
echo " 3. Check your network connection"
echo ""
exit 1
fi
|