soiz1 commited on
Commit
3d35004
Β·
verified Β·
1 Parent(s): 06aa71a

Update upload.sh

Browse files
Files changed (1) hide show
  1. upload.sh +5 -7
upload.sh CHANGED
@@ -1,26 +1,24 @@
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."
 
1
  #!/bin/bash
2
 
 
3
  set -e
4
 
 
5
  if [ -z "$sc4sc_token" ]; then
6
  echo "❌ Error: Environment variable sc4sc_token is not set."
7
  exit 1
8
  fi
9
 
10
+ # Install huggingface_hub CLI if needed
11
  if ! command -v huggingface-cli &> /dev/null; then
12
  echo "πŸ”§ Installing huggingface_hub CLI..."
13
  pip install huggingface_hub[cli]
14
  fi
15
 
16
+ # Secure login: prevent token from appearing in logs
17
  echo "πŸ” Logging into Hugging Face CLI..."
18
+ huggingface-cli login --token <<< "$sc4sc_token" > /dev/null
19
 
20
+ # Upload everything in current directory
21
  echo "πŸ“€ Uploading to Hugging Face Space: sc4sc/editor"
22
+ huggingface-cli upload sc4sc/editor . --repo-type=space --include="*" --yes
23
 
24
  echo "βœ… Upload completed successfully."