LAP-DEV commited on
Commit
5c4c0ce
·
verified ·
1 Parent(s): 6f7ca35

Update modules/whisper/whisper_base.py

Browse files
Files changed (1) hide show
  1. modules/whisper/whisper_base.py +8 -9
modules/whisper/whisper_base.py CHANGED
@@ -214,7 +214,7 @@ class WhisperBase(ABC):
214
  translate_output: bool = False,
215
  translate_model: str = "",
216
  target_lang: str = "",
217
- preview_format: str = "",
218
  progress=gr.Progress(),
219
  *whisper_params,
220
  ) -> list:
@@ -238,8 +238,8 @@ class WhisperBase(ABC):
238
  Translation model to use
239
  target_lang: str
240
  Target language to use
241
- preview_format: str
242
- Preview format to use
243
  progress: gr.Progress
244
  Indicator to show progress directly in gradio.
245
  *whisper_params: tuple
@@ -327,13 +327,12 @@ class WhisperBase(ABC):
327
 
328
  ## Get preview
329
  file_name, file_ext = os.path.splitext(os.path.basename(file))
330
-
331
- if preview_format == "text":
332
- subtitle = get_plaintext(transcribed_segments)
333
- if preview_format == "text with timestamps":
334
  subtitle = get_txt(transcribed_segments)
335
- if preview_format == "csv":
336
- subtitle = get_csv(transcribed_segments)
337
 
338
  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}
339
 
 
214
  translate_output: bool = False,
215
  translate_model: str = "",
216
  target_lang: str = "",
217
+ preview_output: bool = False,
218
  progress=gr.Progress(),
219
  *whisper_params,
220
  ) -> list:
 
238
  Translation model to use
239
  target_lang: str
240
  Target language to use
241
+ preview_output: bool
242
+ Preview option
243
  progress: gr.Progress
244
  Indicator to show progress directly in gradio.
245
  *whisper_params: tuple
 
327
 
328
  ## Get preview
329
  file_name, file_ext = os.path.splitext(os.path.basename(file))
330
+
331
+ ## With or without timestamps
332
+ if preview_output:
 
333
  subtitle = get_txt(transcribed_segments)
334
+ else:
335
+ subtitle = get_plaintext(transcribed_segments)
336
 
337
  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}
338