Spaces:
Running
Running
Merge pull request #372 from jhj0517/fix/lang-selection
Browse files
modules/whisper/base_transcription_pipeline.py
CHANGED
@@ -492,7 +492,7 @@ class BaseTranscriptionPipeline(ABC):
|
|
492 |
params.whisper.lang = None
|
493 |
else:
|
494 |
language_code_dict = {value: key for key, value in whisper.tokenizer.LANGUAGES.items()}
|
495 |
-
params.whisper.lang = language_code_dict[params.lang]
|
496 |
|
497 |
if params.whisper.initial_prompt == GRADIO_NONE_STR:
|
498 |
params.whisper.initial_prompt = None
|
@@ -528,6 +528,9 @@ class BaseTranscriptionPipeline(ABC):
|
|
528 |
|
529 |
if cached_yaml["whisper"].get("lang", None) is None:
|
530 |
cached_yaml["whisper"]["lang"] = AUTOMATIC_DETECTION.unwrap()
|
|
|
|
|
|
|
531 |
|
532 |
if cached_yaml["vad"].get("max_speech_duration_s", float('inf')) == float('inf'):
|
533 |
cached_yaml["vad"]["max_speech_duration_s"] = GRADIO_NONE_NUMBER_MAX
|
|
|
492 |
params.whisper.lang = None
|
493 |
else:
|
494 |
language_code_dict = {value: key for key, value in whisper.tokenizer.LANGUAGES.items()}
|
495 |
+
params.whisper.lang = language_code_dict[params.whisper.lang]
|
496 |
|
497 |
if params.whisper.initial_prompt == GRADIO_NONE_STR:
|
498 |
params.whisper.initial_prompt = None
|
|
|
528 |
|
529 |
if cached_yaml["whisper"].get("lang", None) is None:
|
530 |
cached_yaml["whisper"]["lang"] = AUTOMATIC_DETECTION.unwrap()
|
531 |
+
else:
|
532 |
+
language_dict = whisper.tokenizer.LANGUAGES
|
533 |
+
cached_yaml["whisper"]["lang"] = language_dict[cached_yaml["whisper"]["lang"]]
|
534 |
|
535 |
if cached_yaml["vad"].get("max_speech_duration_s", float('inf')) == float('inf'):
|
536 |
cached_yaml["vad"]["max_speech_duration_s"] = GRADIO_NONE_NUMBER_MAX
|