fish-speech / entrypoint_hf.sh
dev-scezui's picture
Upload 2 files
832adb1 verified
raw
history blame contribute delete
911 Bytes
#!/bin/bash
# entrypoint_hf.sh — runs inside the HF Spaces container at startup
set -e
cd "$(dirname "$0")"
MODEL_REPO="fishaudio/fish-speech-1.5"
MODEL_DIR="${MODEL_DIR:-/app/models/fish-speech-1.5}"
echo "==> Checking for model at ${MODEL_DIR} ..."
if [ ! -f "${MODEL_DIR}/model.pth" ] && [ ! -f "${MODEL_DIR}/config.json" ]; then
echo "==> Model not found. Downloading from HuggingFace Hub..."
huggingface-cli download "${MODEL_REPO}" \
--local-dir "${MODEL_DIR}" \
--local-dir-use-symlinks False
echo "==> Model download complete."
else
echo "==> Model already present, skipping download."
fi
APP_PORT="${APP_PORT:-7860}"
APP_BIND="${APP_BIND:-0.0.0.0}"
APP_WORKERS="${APP_WORKERS:-1}"
echo "==> Starting Fish Speech API on ${APP_BIND}:${APP_PORT} ..."
exec uvicorn \
--host "${APP_BIND}" \
--port "${APP_PORT}" \
--workers "${APP_WORKERS}" \
main:app