Update modules/whisper/whisper_base.py
Browse files
modules/whisper/whisper_base.py
CHANGED
|
@@ -271,13 +271,17 @@ class WhisperBase(ABC):
|
|
| 271 |
# Translate the transcribed segments
|
| 272 |
if translate_output:
|
| 273 |
self.nllb_inf = NLLBInference()
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 281 |
|
| 282 |
## Get preview as txt
|
| 283 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|
|
|
|
| 271 |
# Translate the transcribed segments
|
| 272 |
if translate_output:
|
| 273 |
self.nllb_inf = NLLBInference()
|
| 274 |
+
if src_lang in self.nllb_inf.NLLB_AVAILABLE_LANGS.keys():
|
| 275 |
+
transcribed_segments = self.nllb_inf.translate_text(
|
| 276 |
+
input_list_dict=transcribed_segments,
|
| 277 |
+
model_size=translate_model,
|
| 278 |
+
src_lang=file_language,
|
| 279 |
+
tgt_lang=target_lang,
|
| 280 |
+
speaker_diarization=params.is_diarize
|
| 281 |
+
)
|
| 282 |
+
print (src_lang + " found")
|
| 283 |
+
else:
|
| 284 |
+
print (src_lang + " not supported")
|
| 285 |
|
| 286 |
## Get preview as txt
|
| 287 |
file_name, file_ext = os.path.splitext(os.path.basename(file))
|