Use correct root dir
Browse files- src/whisperContainer.py +7 -1
src/whisperContainer.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
# External programs
|
|
|
2 |
import whisper
|
3 |
|
4 |
from src.modelCache import GLOBAL_MODEL_CACHE, ModelCache
|
@@ -30,8 +31,13 @@ class WhisperContainer:
|
|
30 |
"""
|
31 |
# Warning: Using private API here
|
32 |
try:
|
|
|
|
|
|
|
|
|
|
|
33 |
if self.model_name in whisper._MODELS:
|
34 |
-
whisper._download(whisper._MODELS[self.model_name],
|
35 |
return True
|
36 |
except Exception as e:
|
37 |
# Given that the API is private, it could change at any time. We don't want to crash the program
|
|
|
1 |
# External programs
|
2 |
+
import os
|
3 |
import whisper
|
4 |
|
5 |
from src.modelCache import GLOBAL_MODEL_CACHE, ModelCache
|
|
|
31 |
"""
|
32 |
# Warning: Using private API here
|
33 |
try:
|
34 |
+
root_dir = self.download_root
|
35 |
+
|
36 |
+
if root_dir is None:
|
37 |
+
root_dir = os.path.join(os.path.expanduser("~"), ".cache", "whisper")
|
38 |
+
|
39 |
if self.model_name in whisper._MODELS:
|
40 |
+
whisper._download(whisper._MODELS[self.model_name], root_dir, False)
|
41 |
return True
|
42 |
except Exception as e:
|
43 |
# Given that the API is private, it could change at any time. We don't want to crash the program
|