Spaces:
Runtime error
Runtime error
| # Deployment script for Hugging Face Spaces | |
| set -e | |
| echo "π Deploying Edge Detection Demo to Hugging Face Spaces" | |
| echo "========================================================" | |
| echo "" | |
| # Check if git is initialized | |
| if [ ! -d ".git" ]; then | |
| echo "π¦ Initializing git repository..." | |
| git init | |
| git add . | |
| git commit -m "Initial commit: Edge Detection Demo" | |
| fi | |
| # Get Space information | |
| echo "Please provide your Hugging Face Space details:" | |
| echo "" | |
| read -p "π Space name (e.g., username/edge-detection-demo): " SPACE_NAME | |
| if [ -z "$SPACE_NAME" ]; then | |
| echo "β Space name cannot be empty" | |
| exit 1 | |
| fi | |
| SPACE_URL="https://huggingface.co/spaces/$SPACE_NAME" | |
| echo "" | |
| echo "π Space URL: $SPACE_URL" | |
| echo "" | |
| # Check if 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 Hugging Face remote..." | |
| 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 demo'): " COMMIT_MSG | |
| COMMIT_MSG=${COMMIT_MSG:-"Update demo"} | |
| git commit -m "$COMMIT_MSG" | |
| fi | |
| echo "" | |
| echo "π Pushing to Hugging Face Spaces..." | |
| git push hf main --force | |
| echo "" | |
| echo "β Deployment complete!" | |
| echo "π Your Space will be available at: $SPACE_URL" | |
| echo "" | |
| echo "β±οΈ Note: It may take a few minutes for the Space to build and start." | |