jhj0517 commited on
Commit
b2bb752
·
1 Parent(s): 89df94c

fix constructor to receive model_dir

Browse files
app.py CHANGED
@@ -26,17 +26,25 @@ class App:
26
  whisper_type = self.args.whisper_type.lower().strip()
27
 
28
  if whisper_type in ["faster_whisper", "faster-whisper", "fasterwhisper"]:
29
- whisper_inf = FasterWhisperInference()
 
 
30
  whisper_inf.model_dir = self.args.faster_whisper_model_dir
31
  elif whisper_type in ["whisper"]:
32
- whisper_inf = WhisperInference()
 
 
33
  whisper_inf.model_dir = self.args.whisper_model_dir
34
  elif whisper_type in ["insanely_fast_whisper", "insanely-fast-whisper", "insanelyfastwhisper",
35
  "insanely_faster_whisper", "insanely-faster-whisper", "insanelyfasterwhisper"]:
36
- whisper_inf = InsanelyFastWhisperInference()
 
 
37
  whisper_inf.model_dir = self.args.insanely_fast_whisper_model_dir
38
  else:
39
- whisper_inf = FasterWhisperInference()
 
 
40
  whisper_inf.model_dir = self.args.faster_whisper_model_dir
41
  return whisper_inf
42
 
 
26
  whisper_type = self.args.whisper_type.lower().strip()
27
 
28
  if whisper_type in ["faster_whisper", "faster-whisper", "fasterwhisper"]:
29
+ whisper_inf = FasterWhisperInference(
30
+ model_dir=self.args.faster_whisper_model_dir
31
+ )
32
  whisper_inf.model_dir = self.args.faster_whisper_model_dir
33
  elif whisper_type in ["whisper"]:
34
+ whisper_inf = WhisperInference(
35
+ model_dir=self.args.whisper_model_dir
36
+ )
37
  whisper_inf.model_dir = self.args.whisper_model_dir
38
  elif whisper_type in ["insanely_fast_whisper", "insanely-fast-whisper", "insanelyfastwhisper",
39
  "insanely_faster_whisper", "insanely-faster-whisper", "insanelyfasterwhisper"]:
40
+ whisper_inf = InsanelyFastWhisperInference(
41
+ model_dir=self.args.insanely_fast_whisper_model_dir
42
+ )
43
  whisper_inf.model_dir = self.args.insanely_fast_whisper_model_dir
44
  else:
45
+ whisper_inf = FasterWhisperInference(
46
+ model_dir=self.args.faster_whisper_model_dir
47
+ )
48
  whisper_inf.model_dir = self.args.faster_whisper_model_dir
49
  return whisper_inf
50
 
modules/faster_whisper_inference.py CHANGED
@@ -17,9 +17,11 @@ os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
17
 
18
 
19
  class FasterWhisperInference(WhisperBase):
20
- def __init__(self):
 
 
21
  super().__init__(
22
- model_dir=os.path.join("models", "Whisper", "faster-whisper")
23
  )
24
  self.model_paths = self.get_model_paths()
25
  self.available_models = self.model_paths.keys()
 
17
 
18
 
19
  class FasterWhisperInference(WhisperBase):
20
+ def __init__(self,
21
+ model_dir: str
22
+ ):
23
  super().__init__(
24
+ model_dir=model_dir
25
  )
26
  self.model_paths = self.get_model_paths()
27
  self.available_models = self.model_paths.keys()
modules/insanely_fast_whisper_inference.py CHANGED
@@ -15,9 +15,11 @@ from modules.whisper_base import WhisperBase
15
 
16
 
17
  class InsanelyFastWhisperInference(WhisperBase):
18
- def __init__(self):
 
 
19
  super().__init__(
20
- model_dir=os.path.join("models", "Whisper", "insanely_fast_whisper")
21
  )
22
  openai_models = whisper.available_models()
23
  distil_models = ["distil-large-v2", "distil-large-v3", "distil-medium.en", "distil-small.en"]
 
15
 
16
 
17
  class InsanelyFastWhisperInference(WhisperBase):
18
+ def __init__(self,
19
+ model_dir: str
20
+ ):
21
  super().__init__(
22
+ model_dir=model_dir
23
  )
24
  openai_models = whisper.available_models()
25
  distil_models = ["distil-large-v2", "distil-large-v3", "distil-medium.en", "distil-small.en"]
modules/whisper_Inference.py CHANGED
@@ -11,9 +11,11 @@ from modules.whisper_parameter import *
11
 
12
 
13
  class WhisperInference(WhisperBase):
14
- def __init__(self):
 
 
15
  super().__init__(
16
- model_dir=os.path.join("models", "Whisper")
17
  )
18
 
19
  def transcribe(self,
 
11
 
12
 
13
  class WhisperInference(WhisperBase):
14
+ def __init__(self,
15
+ model_dir: str
16
+ ):
17
  super().__init__(
18
+ model_dir=model_dir
19
  )
20
 
21
  def transcribe(self,