Spaces:
Sleeping
Sleeping
TeleologyHI commited on
Commit ·
bd47d2d
1
Parent(s): 790877f
Update
Browse files- scripts/deploy_to_hf.sh +18 -9
scripts/deploy_to_hf.sh
CHANGED
|
@@ -10,13 +10,12 @@
|
|
| 10 |
# - Use environment variables for sensitive information
|
| 11 |
# - Store secrets in a secure location, not in your code
|
| 12 |
#
|
| 13 |
-
# Required environment variables:
|
| 14 |
# - HUGGING_FACE_TOKEN: Your Hugging Face API token
|
| 15 |
-
# - HUGGING_FACE_SPACE
|
| 16 |
#
|
| 17 |
# How to use:
|
| 18 |
-
# 1.
|
| 19 |
-
# export HUGGING_FACE_TOKEN="your_token_here"
|
| 20 |
#
|
| 21 |
# 2. Run the script:
|
| 22 |
# ./scripts/deploy_to_hf.sh
|
|
@@ -98,12 +97,25 @@ if [ $MISSING_DEPS -eq 1 ]; then
|
|
| 98 |
exit 1
|
| 99 |
fi
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
# Check for required environment variables
|
| 102 |
log_info "Checking environment variables..."
|
| 103 |
|
| 104 |
if [ -z "$HUGGING_FACE_TOKEN" ]; then
|
| 105 |
-
log_error "HUGGING_FACE_TOKEN environment variable is not set!"
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
exit 1
|
| 108 |
fi
|
| 109 |
|
|
@@ -118,8 +130,6 @@ if ! validate_token "$HUGGING_FACE_TOKEN"; then
|
|
| 118 |
fi
|
| 119 |
fi
|
| 120 |
|
| 121 |
-
# Set default Hugging Face space or use provided value
|
| 122 |
-
HUGGING_FACE_SPACE="${HUGGING_FACE_SPACE:-TeleologyHI/HIM-self}"
|
| 123 |
log_info "Deploying to Hugging Face space: $HUGGING_FACE_SPACE"
|
| 124 |
|
| 125 |
# Login to Hugging Face
|
|
@@ -219,4 +229,3 @@ print(result)
|
|
| 219 |
EOF
|
| 220 |
|
| 221 |
exit 0
|
| 222 |
-
|
|
|
|
| 10 |
# - Use environment variables for sensitive information
|
| 11 |
# - Store secrets in a secure location, not in your code
|
| 12 |
#
|
| 13 |
+
# Required environment variables from .env file in project root:
|
| 14 |
# - HUGGING_FACE_TOKEN: Your Hugging Face API token
|
| 15 |
+
# - HUGGING_FACE_SPACE: Your Hugging Face space name
|
| 16 |
#
|
| 17 |
# How to use:
|
| 18 |
+
# 1. Make sure .env file exists in project root with proper variables
|
|
|
|
| 19 |
#
|
| 20 |
# 2. Run the script:
|
| 21 |
# ./scripts/deploy_to_hf.sh
|
|
|
|
| 97 |
exit 1
|
| 98 |
fi
|
| 99 |
|
| 100 |
+
# Load environment variables from .env file
|
| 101 |
+
log_info "Loading environment variables from .env file..."
|
| 102 |
+
if [ -f "$PROJECT_ROOT/.env" ]; then
|
| 103 |
+
source "$PROJECT_ROOT/.env"
|
| 104 |
+
else
|
| 105 |
+
log_error ".env file not found in project root directory!"
|
| 106 |
+
exit 1
|
| 107 |
+
fi
|
| 108 |
+
|
| 109 |
# Check for required environment variables
|
| 110 |
log_info "Checking environment variables..."
|
| 111 |
|
| 112 |
if [ -z "$HUGGING_FACE_TOKEN" ]; then
|
| 113 |
+
log_error "HUGGING_FACE_TOKEN environment variable is not set in .env file!"
|
| 114 |
+
exit 1
|
| 115 |
+
fi
|
| 116 |
+
|
| 117 |
+
if [ -z "$HUGGING_FACE_SPACE" ]; then
|
| 118 |
+
log_error "HUGGING_FACE_SPACE environment variable is not set in .env file!"
|
| 119 |
exit 1
|
| 120 |
fi
|
| 121 |
|
|
|
|
| 130 |
fi
|
| 131 |
fi
|
| 132 |
|
|
|
|
|
|
|
| 133 |
log_info "Deploying to Hugging Face space: $HUGGING_FACE_SPACE"
|
| 134 |
|
| 135 |
# Login to Hugging Face
|
|
|
|
| 229 |
EOF
|
| 230 |
|
| 231 |
exit 0
|
|
|