Skip to content

Commit

Permalink
Merge pull request #372 from jhj0517/fix/lang-selection
Browse files Browse the repository at this point in the history
Fix language key bug
  • Loading branch information
jhj0517 authored Nov 1, 2024
2 parents 71e7964 + d41e01c commit 0295d69
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/whisper/base_transcription_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def validate_gradio_values(params: TranscriptionPipelineParams):
params.whisper.lang = None
else:
language_code_dict = {value: key for key, value in whisper.tokenizer.LANGUAGES.items()}
params.whisper.lang = language_code_dict[params.lang]
params.whisper.lang = language_code_dict[params.whisper.lang]

if params.whisper.initial_prompt == GRADIO_NONE_STR:
params.whisper.initial_prompt = None
Expand Down Expand Up @@ -528,6 +528,9 @@ def cache_parameters(

if cached_yaml["whisper"].get("lang", None) is None:
cached_yaml["whisper"]["lang"] = AUTOMATIC_DETECTION.unwrap()
else:
language_dict = whisper.tokenizer.LANGUAGES
cached_yaml["whisper"]["lang"] = language_dict[cached_yaml["whisper"]["lang"]]

if cached_yaml["vad"].get("max_speech_duration_s", float('inf')) == float('inf'):
cached_yaml["vad"]["max_speech_duration_s"] = GRADIO_NONE_NUMBER_MAX
Expand Down

0 comments on commit 0295d69

Please sign in to comment.