File size: 441 Bytes
bcc9a12
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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.')
"