Spaces:
Build error
Build error
File size: 728 Bytes
c8abb98 |
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 |
#!/bin/bash
# Exit on error
set -e
# Check if the token is set
if [ -z "$sc4sc_token" ]; then
echo "Error: Environment variable sc4sc_token is not set."
exit 1
fi
# Define variables
SPACE_REPO="sc4sc/editor"
API_URL="https://huggingface.co/api/spaces/$SPACE_REPO"
TEMP_DIR=$(mktemp -d)
ZIP_FILE="$TEMP_DIR/upload.zip"
# Create zip of all files and folders in current directory
zip -r "$ZIP_FILE" . -x "*.git*" -x "$ZIP_FILE"
# Upload to the space
echo "Uploading to Hugging Face Space: $SPACE_REPO"
curl -X POST "$API_URL/upload" \
-H "Authorization: Bearer $sc4sc_token" \
-H "Content-Type: application/zip" \
--data-binary @"$ZIP_FILE"
# Clean up
rm -rf "$TEMP_DIR"
echo "✅ Upload completed successfully."
|