Update modules/whisper/whisper_base.py
Browse files- modules/whisper/whisper_base.py +13 -13
modules/whisper/whisper_base.py
CHANGED
@@ -266,27 +266,27 @@ class WhisperBase(ABC):
|
|
266 |
# Translate to English using Whisper built-in functionality
|
267 |
transcription_note = ""
|
268 |
if params.is_translate:
|
269 |
-
transcription_note = "To English
|
270 |
source_lang = "English"
|
271 |
|
272 |
# Translate the transcribed segments
|
273 |
translation_note = ""
|
274 |
if translate_output:
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
translation_note = source_lang + " to " + target_lang + " (using Facebook NLLB)"
|
286 |
else:
|
287 |
-
translation_note =
|
288 |
else:
|
289 |
-
translation_note =
|
290 |
|
291 |
## Get preview as txt
|
292 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
|
|
266 |
# Translate to English using Whisper built-in functionality
|
267 |
transcription_note = ""
|
268 |
if params.is_translate:
|
269 |
+
transcription_note = "To English\n\t\t\t(using Whisper)"
|
270 |
source_lang = "English"
|
271 |
|
272 |
# Translate the transcribed segments
|
273 |
translation_note = ""
|
274 |
if translate_output:
|
275 |
+
if source_lang != target_lang:
|
276 |
+
self.nllb_inf = NLLBInference()
|
277 |
+
if source_lang in NLLB_AVAILABLE_LANGS.keys():
|
278 |
+
transcribed_segments = self.nllb_inf.translate_text(
|
279 |
+
input_list_dict=transcribed_segments,
|
280 |
+
model_size=translate_model,
|
281 |
+
src_lang=source_lang,
|
282 |
+
tgt_lang=target_lang,
|
283 |
+
speaker_diarization=params.is_diarize
|
284 |
+
)
|
285 |
translation_note = source_lang + " to " + target_lang + " (using Facebook NLLB)"
|
286 |
else:
|
287 |
+
translation_note = source_lang + " not supported (using Facebook NLLB)"
|
288 |
else:
|
289 |
+
translation_note = "None (Already in " + target_lang + ")"
|
290 |
|
291 |
## Get preview as txt
|
292 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|