Switch whisper model cache to /models/ (#808)

This commit is contained in:
Raivis Dejus 2024-06-21 15:05:13 +03:00 committed by GitHub
commit 9e6d722ca9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View file

@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-20 23:14+0300\n"
"PO-Revision-Date: 2024-06-20 23:15+0300\n"
"PO-Revision-Date: 2024-06-21 14:22+0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: lv_LV\n"
@ -451,7 +451,7 @@ msgstr "Lejupielādē modeli"
#: buzz/widgets/model_download_progress_dialog.py:37
msgid "remaining"
msgstr "atlicis"
msgstr "!"
#: buzz/widgets/menu_bar.py:38
msgid "Import File..."

View file

@ -37,6 +37,7 @@ os.makedirs(model_root_dir, exist_ok=True)
logging.debug("Model root directory: %s", model_root_dir)
class WhisperModelSize(str, enum.Enum):
TINY = "tiny"
BASE = "base"
@ -215,9 +216,7 @@ def get_whisper_cpp_file_path(size: WhisperModelSize) -> str:
def get_whisper_file_path(size: WhisperModelSize) -> str:
root_dir = os.getenv(
"XDG_CACHE_HOME", os.path.join(os.path.expanduser("~"), ".cache", "whisper")
)
root_dir = os.path.join(model_root_dir, "whisper")
url = whisper._MODELS[size.value]
return os.path.join(root_dir, os.path.basename(url))