Update modules/whisper/whisper_base.py
Browse files
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 |
-
|
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 |
-
|
242 |
-
Preview
|
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 |
-
|
332 |
-
|
333 |
-
if preview_format == "text with timestamps":
|
334 |
subtitle = get_txt(transcribed_segments)
|
335 |
-
|
336 |
-
subtitle =
|
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 |
|