Spaces:
Runtime error
Runtime error
Update upload.sh
Browse files
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
|
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 |
-
#
|
19 |
echo "π Logging into Hugging Face CLI..."
|
20 |
-
|
21 |
|
22 |
-
# Upload current directory
|
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."
|