jhj0517 commited on
Commit
e65592d
1 Parent(s): 30d7c58
Files changed (1) hide show
  1. modules/faster_whisper_inference.py +4 -10
modules/faster_whisper_inference.py CHANGED
@@ -82,9 +82,6 @@ class FasterWhisperInference(BaseInterface):
82
  try:
83
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
84
 
85
- if lang == "Automatic Detection":
86
- lang = None
87
-
88
  files_info = {}
89
  for fileobj in fileobjs:
90
  transcribed_segments, time_for_task = self.transcribe(
@@ -176,9 +173,6 @@ class FasterWhisperInference(BaseInterface):
176
  try:
177
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
178
 
179
- if lang == "Automatic Detection":
180
- lang = None
181
-
182
  progress(0, desc="Loading Audio from Youtube..")
183
  yt = get_ytdata(youtubelink)
184
  audio = get_ytaudio(yt)
@@ -268,9 +262,6 @@ class FasterWhisperInference(BaseInterface):
268
  try:
269
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
270
 
271
- if lang == "Automatic Detection":
272
- lang = None
273
-
274
  progress(0, desc="Loading Audio..")
275
 
276
  transcribed_segments, time_for_task = self.transcribe(
@@ -338,7 +329,10 @@ class FasterWhisperInference(BaseInterface):
338
  elapsed time for transcription
339
  """
340
  start_time = time.time()
341
- if lang:
 
 
 
342
  language_code_dict = {value: key for key, value in whisper.tokenizer.LANGUAGES.items()}
343
  lang = language_code_dict[lang]
344
  segments, info = self.model.transcribe(
 
82
  try:
83
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
84
 
 
 
 
85
  files_info = {}
86
  for fileobj in fileobjs:
87
  transcribed_segments, time_for_task = self.transcribe(
 
173
  try:
174
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
175
 
 
 
 
176
  progress(0, desc="Loading Audio from Youtube..")
177
  yt = get_ytdata(youtubelink)
178
  audio = get_ytaudio(yt)
 
262
  try:
263
  self.update_model_if_needed(model_size=model_size, compute_type=compute_type, progress=progress)
264
 
 
 
 
265
  progress(0, desc="Loading Audio..")
266
 
267
  transcribed_segments, time_for_task = self.transcribe(
 
329
  elapsed time for transcription
330
  """
331
  start_time = time.time()
332
+
333
+ if lang == "Automatic Detection":
334
+ lang = None
335
+ else:
336
  language_code_dict = {value: key for key, value in whisper.tokenizer.LANGUAGES.items()}
337
  lang = language_code_dict[lang]
338
  segments, info = self.model.transcribe(