LAP-DEV commited on
Commit
0086005
·
verified ·
1 Parent(s): da8c28a

Update modules/whisper/whisper_base.py

Browse files
Files changed (1) hide show
  1. modules/whisper/whisper_base.py +4 -10
modules/whisper/whisper_base.py CHANGED
@@ -256,7 +256,7 @@ class WhisperBase(ABC):
256
  Input folder path to transcribe from gr.Textbox(). If this is provided, `files` will be ignored and
257
  this will be used instead.
258
  file_format: str
259
- Subtitle File format to write from gr.Dropdown(). Supported format: [SRT, WebVTT, txt]
260
  add_timestamp: bool
261
  Boolean value from gr.Checkbox() that determines whether to add a timestamp at the end of the subtitle filename.
262
  translate_output: bool
@@ -360,16 +360,10 @@ class WhisperBase(ABC):
360
  files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext), "translation": translation_note, "transcription": transcription_note}
361
 
362
  ## Add output file as txt, srt and/or csv
363
- for format in file_format:
364
  file_name, file_ext = os.path.splitext(os.path.basename(file))
365
- subtitle, file_path = self.generate_and_write_file(
366
- file_name=file_name,
367
- transcribed_segments=transcribed_segments,
368
- add_timestamp=add_timestamp,
369
- file_format=format.lower(),
370
- output_dir=self.output_dir
371
- )
372
- files_to_download[file_name+"_"+format.lower()] = {"path": file_path}
373
 
374
  total_result = ""
375
  total_info = ""
 
256
  Input folder path to transcribe from gr.Textbox(). If this is provided, `files` will be ignored and
257
  this will be used instead.
258
  file_format: str
259
+ Subtitle File format to write from gr.Dropdown(). Supported format: [CSV, SRT, TXT]
260
  add_timestamp: bool
261
  Boolean value from gr.Checkbox() that determines whether to add a timestamp at the end of the subtitle filename.
262
  translate_output: bool
 
360
  files_info[file_name] = {"subtitle": subtitle, "time_for_task": time_for_task, "lang": file_language, "lang_prob": file_lang_probs, "input_source_file": (file_name+file_ext), "translation": translation_note, "transcription": transcription_note}
361
 
362
  ## Add output file as txt, srt and/or csv
363
+ for output_format in file_format:
364
  file_name, file_ext = os.path.splitext(os.path.basename(file))
365
+ subtitle, file_path = self.generate_and_write_file(file_name,transcribed_segments,add_timestamp,output_format.lower(),self.output_dir)
366
+ files_to_download[file_name+"_"+output_format.lower()] = {"path": file_path}
 
 
 
 
 
 
367
 
368
  total_result = ""
369
  total_info = ""