change location of default path variables

This commit is contained in:
Jaikinator
2023-06-27 10:22:03 +02:00
parent d882d80d1d
commit 58a14b2adf
3 changed files with 21 additions and 91 deletions
+2 -14
View File
@@ -2,24 +2,12 @@ import os
from whisper import Whisper, load_model
from typing import TypeVar , Union
from glob import glob
from .misc import WHISPER_DEFAULT_PATH
whisper = TypeVar('whisper')
Tensor = TypeVar('Tensor')
nparray = TypeVar('nparray')
def get_whisper_default_path() -> str:
"""
Get default path for whisper models
Returns
-------
str
path
"""
_path = os.path.dirname(os.path.dirname(__file__))
return os.path.join(_path, "models", "whisper")
WHISPER_DEFAULT_PATH = get_whisper_default_path()
class Transcriber:
def __init__(self, model: whisper ) -> None:
@@ -68,7 +56,7 @@ class Transcriber:
def load_model(cls,
model: str = "medium",
local : bool = True,
download_root: str = WHISPER_DEFAULT_PATH ,
download_root: str = WHISPER_DEFAULT_PATH,
*args, **kwargs) -> 'Transcriber':
"""
Load whisper module