soiz1 commited on
Commit
06aa71a
·
verified ·
1 Parent(s): 83af368

Update upload.sh

Browse files
Files changed (1) hide show
  1. upload.sh +16 -15
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
- # Gitが安全と認識するようにする(必要最低限の変更)
10
- git config --global --add safe.directory /app
11
-
12
- SPACE_REPO="sc4sc/editor"
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
- git add .
22
- git commit -m "Automated update" || echo "Nothing to commit"
23
- git push origin main
 
 
 
 
24
 
25
- echo "✅ Space successfully updated."
 
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."