Spaces:
Running
Running
| # 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.') | |
| " | |