File size: 1,620 Bytes
dead0ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef9c644
dead0ef
 
 
 
 
 
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
#!/bin/bash

# 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."