OpenSound commited on
Commit
54f231c
·
1 Parent(s): 915b86a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -29,7 +29,7 @@ DEMO_PATH = os.getenv("DEMO_PATH", "./demo")
29
  TMP_PATH = os.getenv("TMP_PATH", "./demo/temp")
30
  MODELS_PATH = os.getenv("MODELS_PATH", "./pretrained_models")
31
  device = "cuda" if torch.cuda.is_available() else "cpu"
32
- whisper_model, align_model, ssrspeech_model = None, None, None
33
 
34
  def get_random_string():
35
  return "".join(str(uuid.uuid4()).split("-"))
@@ -134,16 +134,16 @@ def load_models(ssrspeech_model_name):
134
  ssrspeech_model_name = "English"
135
  text_tokenizer = TextTokenizer(backend="espeak")
136
  language = "en"
137
- whisper_model_name = "base.en"
138
 
139
  elif ssrspeech_model_name == "Mandarin":
140
  ssrspeech_model_name = "Mandarin"
141
  text_tokenizer = TextTokenizer(backend="espeak", language='cmn')
142
  language = "zh"
143
- whisper_model_name = "base"
144
 
145
  align_model = WhisperxAlignModel(language)
146
- transcribe_model = WhisperxModel(whisper_model_name, align_model, language)
147
 
148
  ssrspeech_fn = f"{MODELS_PATH}/{ssrspeech_model_name}.pth"
149
  if not os.path.exists(ssrspeech_fn):
 
29
  TMP_PATH = os.getenv("TMP_PATH", "./demo/temp")
30
  MODELS_PATH = os.getenv("MODELS_PATH", "./pretrained_models")
31
  device = "cuda" if torch.cuda.is_available() else "cpu"
32
+ transcribe_model, align_model, ssrspeech_model = None, None, None
33
 
34
  def get_random_string():
35
  return "".join(str(uuid.uuid4()).split("-"))
 
134
  ssrspeech_model_name = "English"
135
  text_tokenizer = TextTokenizer(backend="espeak")
136
  language = "en"
137
+ transcribe_model_name = "base.en"
138
 
139
  elif ssrspeech_model_name == "Mandarin":
140
  ssrspeech_model_name = "Mandarin"
141
  text_tokenizer = TextTokenizer(backend="espeak", language='cmn')
142
  language = "zh"
143
+ transcribe_model_name = "base"
144
 
145
  align_model = WhisperxAlignModel(language)
146
+ transcribe_model = WhisperxModel(transcribe_model_name, align_model, language)
147
 
148
  ssrspeech_fn = f"{MODELS_PATH}/{ssrspeech_model_name}.pth"
149
  if not os.path.exists(ssrspeech_fn):