Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -280,14 +280,14 @@ class WhisperBase(ABC):
|
|
| 280 |
tgt_lang=target_lang,
|
| 281 |
speaker_diarization=params.is_diarize
|
| 282 |
)
|
| 283 |
-
|
| 284 |
else:
|
| 285 |
-
|
| 286 |
|
| 287 |
## Get preview as txt
|
| 288 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
| 289 |
subtitle = get_txt(transcribed_segments)
|
| 290 |
-
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)}
|
| 291 |
|
| 292 |
## Add output file as txt
|
| 293 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
|
@@ -329,6 +329,8 @@ class WhisperBase(ABC):
|
|
| 329 |
total_result += f'{info["subtitle"]}'
|
| 330 |
total_time += info["time_for_task"]
|
| 331 |
total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]} with probability {info["lang_prob"]}%\n'
|
|
|
|
|
|
|
| 332 |
|
| 333 |
#total_info += f"\nTranscription duration: {self.format_time(total_time)}"
|
| 334 |
time_end = datetime.now()
|
|
|
|
| 280 |
tgt_lang=target_lang,
|
| 281 |
speaker_diarization=params.is_diarize
|
| 282 |
)
|
| 283 |
+
translation_note = "from " + file_language + " to " + target_lang
|
| 284 |
else:
|
| 285 |
+
translation_note = file_language + " not supported"
|
| 286 |
|
| 287 |
## Get preview as txt
|
| 288 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
| 289 |
subtitle = get_txt(transcribed_segments)
|
| 290 |
+
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}
|
| 291 |
|
| 292 |
## Add output file as txt
|
| 293 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
|
|
|
| 329 |
total_result += f'{info["subtitle"]}'
|
| 330 |
total_time += info["time_for_task"]
|
| 331 |
total_info += f'Input file: {info["input_source_file"]}\nLanguage: {info["lang"]} with probability {info["lang_prob"]}%\n'
|
| 332 |
+
if translate_output:
|
| 333 |
+
total_info += f'Translation: {info["translation"]}\n'
|
| 334 |
|
| 335 |
#total_info += f"\nTranscription duration: {self.format_time(total_time)}"
|
| 336 |
time_end = datetime.now()
|