ground-zero / setup.sh
jefffffff9
Add setup.sh to pre-cache Whisper model during build
bcc9a12
raw
history blame contribute delete
441 Bytes
#!/bin/bash
# Runs during HF Spaces build phase (build layer is cached).
# Pre-downloads the Whisper model so cold starts don't re-download it.
# WHISPER_MODEL_ID is available as an env var at build time if set in Space secrets.
MODEL=${WHISPER_MODEL_ID:-openai/whisper-small}
echo "Pre-caching $MODEL ..."
python -c "
from huggingface_hub import snapshot_download
import os
snapshot_download('${MODEL}', repo_type='model')
print('Done.')
"