Jhjoon05 commited on
Commit
dfe2ca6
1 Parent(s): 42af183

specified model directory

Browse files
Files changed (1) hide show
  1. modules/model_Inference.py +7 -5
modules/model_Inference.py CHANGED
@@ -5,11 +5,13 @@ import gradio as gr
5
  import os
6
  from datetime import datetime
7
 
 
 
8
  class WhisperInference():
9
  def __init__(self):
10
  print("\nInitializing Model..\n")
11
- self.current_model_size = "large-v2"
12
- self.model = whisper.load_model(self.current_model_size)
13
  self.available_models = whisper.available_models()
14
  self.available_langs = sorted(list(whisper.tokenizer.LANGUAGES.values()))
15
 
@@ -23,7 +25,7 @@ class WhisperInference():
23
  if model_size != self.current_model_size:
24
  progress(0,desc="Initializing Model..")
25
  self.current_model_size = model_size
26
- self.model = whisper.load_model(model_size)
27
 
28
  if lang == "Automatic Detection" :
29
  lang = None
@@ -63,7 +65,7 @@ class WhisperInference():
63
  if model_size != self.current_model_size:
64
  progress(0,desc="Initializing Model..")
65
  self.current_model_size = model_size
66
- self.model = whisper.load_model(model_size)
67
 
68
  if lang == "Automatic Detection" :
69
  lang = None
@@ -102,7 +104,7 @@ class WhisperInference():
102
  if model_size != self.current_model_size:
103
  progress(0,desc="Initializing Model..")
104
  self.current_model_size = model_size
105
- self.model = whisper.load_model(model_size)
106
 
107
  if lang == "Automatic Detection" :
108
  lang = None
 
5
  import os
6
  from datetime import datetime
7
 
8
+ DEFAULT_MODEL_SIZE="large-v2"
9
+
10
  class WhisperInference():
11
  def __init__(self):
12
  print("\nInitializing Model..\n")
13
+ self.current_model_size = DEFAULT_MODEL_SIZE
14
+ self.model = whisper.load_model(name=DEFAULT_MODEL_SIZE,download_root="models")
15
  self.available_models = whisper.available_models()
16
  self.available_langs = sorted(list(whisper.tokenizer.LANGUAGES.values()))
17
 
 
25
  if model_size != self.current_model_size:
26
  progress(0,desc="Initializing Model..")
27
  self.current_model_size = model_size
28
+ self.model = whisper.load_model(name=model_size,download_root="models")
29
 
30
  if lang == "Automatic Detection" :
31
  lang = None
 
65
  if model_size != self.current_model_size:
66
  progress(0,desc="Initializing Model..")
67
  self.current_model_size = model_size
68
+ self.model = whisper.load_model(name=model_size,download_root="models")
69
 
70
  if lang == "Automatic Detection" :
71
  lang = None
 
104
  if model_size != self.current_model_size:
105
  progress(0,desc="Initializing Model..")
106
  self.current_model_size = model_size
107
+ self.model = whisper.load_model(name=model_size,download_root="models")
108
 
109
  if lang == "Automatic Detection" :
110
  lang = None