File size: 911 Bytes
832adb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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