Spaces:
Running
Running
Update download_model.py
Browse files- download_model.py +8 -5
download_model.py
CHANGED
@@ -2,11 +2,14 @@ from transformers import WhisperProcessor, WhisperForConditionalGeneration
|
|
2 |
import os
|
3 |
|
4 |
# Ensure the cache directory exists
|
5 |
-
cache_dir = "
|
6 |
os.makedirs(cache_dir, exist_ok=True)
|
7 |
|
8 |
-
# Download the model and processor
|
9 |
print("Downloading Whisper model and processor...")
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
2 |
import os
|
3 |
|
4 |
# Ensure the cache directory exists
|
5 |
+
cache_dir = "/app/.cache"
|
6 |
os.makedirs(cache_dir, exist_ok=True)
|
7 |
|
|
|
8 |
print("Downloading Whisper model and processor...")
|
9 |
+
try:
|
10 |
+
processor = WhisperProcessor.from_pretrained("openai/whisper-large-v3", cache_dir=cache_dir)
|
11 |
+
model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v3", cache_dir=cache_dir)
|
12 |
+
print("✓ Model and processor downloaded successfully!")
|
13 |
+
except Exception as e:
|
14 |
+
print(f"Failed to download model: {e}")
|
15 |
+
raise
|