Spaces:
Sleeping
Sleeping
Upload scripts/entrypoint.sh via API
Browse files- scripts/entrypoint.sh +9 -0
scripts/entrypoint.sh
CHANGED
|
@@ -15,6 +15,15 @@ fi
|
|
| 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"
|
|
|
|
| 15 |
export GRADIO_SERVER_NAME=${GRADIO_SERVER_NAME:-0.0.0.0}
|
| 16 |
export GRADIO_SERVER_PORT=${GRADIO_SERVER_PORT:-7860}
|
| 17 |
|
| 18 |
+
# Ensure application writable directories exist and are world-writable so
|
| 19 |
+
# the app (possibly running as non-root inside Spaces) can create caches,
|
| 20 |
+
# temp files and matplotlib config without permission errors.
|
| 21 |
+
mkdir -p /app/app_cache /app/app_tmp /app/speechbrain_cache /app/.cache/matplotlib
|
| 22 |
+
chmod 0777 /app/app_cache /app/app_tmp /app/speechbrain_cache /app/.cache/matplotlib || true
|
| 23 |
+
|
| 24 |
+
# Point Matplotlib config to a writable directory to avoid attempts to write to /.config
|
| 25 |
+
export MPLCONFIGDIR=${MPLCONFIGDIR:-/app/.cache/matplotlib}
|
| 26 |
+
|
| 27 |
# Optional pre-download step: run scripts/download_models.py if present
|
| 28 |
if [ -f /app/scripts/download_models.py ]; then
|
| 29 |
echo "[entrypoint] Found scripts/download_models.py — attempting to run it"
|