Spaces:
Running
Running
Update upload.sh
Browse files
upload.sh
CHANGED
@@ -1,25 +1,26 @@
|
|
1 |
#!/bin/bash
|
|
|
|
|
2 |
set -e
|
3 |
|
|
|
4 |
if [ -z "$sc4sc_token" ]; then
|
5 |
-
echo "Error: Environment variable sc4sc_token is not set."
|
6 |
exit 1
|
7 |
fi
|
8 |
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
GIT_URL="https://[email protected]/spaces/$SPACE_REPO"
|
14 |
-
|
15 |
-
# Gitリポジトリが未初期化なら初期化
|
16 |
-
if [ ! -d ".git" ]; then
|
17 |
-
git init
|
18 |
-
git remote add origin "$GIT_URL"
|
19 |
fi
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
echo "✅
|
|
|
1 |
#!/bin/bash
|
2 |
+
|
3 |
+
# Exit immediately if any command fails
|
4 |
set -e
|
5 |
|
6 |
+
# Check if token is set
|
7 |
if [ -z "$sc4sc_token" ]; then
|
8 |
+
echo "❌ Error: Environment variable sc4sc_token is not set."
|
9 |
exit 1
|
10 |
fi
|
11 |
|
12 |
+
# Install huggingface_hub if not already installed
|
13 |
+
if ! command -v huggingface-cli &> /dev/null; then
|
14 |
+
echo "🔧 Installing huggingface_hub CLI..."
|
15 |
+
pip install huggingface_hub[cli]
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
fi
|
17 |
|
18 |
+
# Login to Hugging Face CLI using the token
|
19 |
+
echo "🔐 Logging into Hugging Face CLI..."
|
20 |
+
echo "$sc4sc_token" | huggingface-cli login --token
|
21 |
+
|
22 |
+
# Upload current directory to the Space
|
23 |
+
echo "📤 Uploading to Hugging Face Space: sc4sc/editor"
|
24 |
+
huggingface-cli upload sc4sc/editor . --repo-type=space --include="*"
|
25 |
|
26 |
+
echo "✅ Upload completed successfully."
|