Spaces:
Sleeping
Sleeping
Upload scripts/entrypoint.sh via API
Browse files- scripts/entrypoint.sh +25 -0
scripts/entrypoint.sh
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "[entrypoint] Starting entrypoint script..."
|
| 5 |
+
|
| 6 |
+
# If a hf_token.txt file is present in the repo, export it as HF_TOKEN so
|
| 7 |
+
# the container can download models at runtime. HF Spaces can also set the
|
| 8 |
+
# HF_TOKEN secret in the UI which will override this.
|
| 9 |
+
if [ -f /app/hf_token.txt ]; then
|
| 10 |
+
export HF_TOKEN="$(cat /app/hf_token.txt)"
|
| 11 |
+
echo "[entrypoint] HF_TOKEN loaded from /app/hf_token.txt"
|
| 12 |
+
fi
|
| 13 |
+
|
| 14 |
+
# Default bind settings for Gradio/Spaces
|
| 15 |
+
export GRADIO_SERVER_NAME=${GRADIO_SERVER_NAME:-0.0.0.0}
|
| 16 |
+
export GRADIO_SERVER_PORT=${GRADIO_SERVER_PORT:-7860}
|
| 17 |
+
|
| 18 |
+
# Optional pre-download step: run scripts/download_models.py if present
|
| 19 |
+
if [ -f /app/scripts/download_models.py ]; then
|
| 20 |
+
echo "[entrypoint] Found scripts/download_models.py — attempting to run it"
|
| 21 |
+
python /app/scripts/download_models.py || echo "[entrypoint] download_models.py failed or exited non-zero — continuing"
|
| 22 |
+
fi
|
| 23 |
+
|
| 24 |
+
echo "[entrypoint] Launching application (python /app/app.py)"
|
| 25 |
+
exec python -u /app/app.py
|