Minor update to deal with gr.dropdown
resolves complaints about custom messages in the dropdowns for language, default & narrator voice.
This commit is contained in:
1 parent
c681cd7e4d
commit
c5c1a455df
1 file changed
+10
-4
@@ -642,9 +642,14 @@ def ui():
|
|||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
voice = gr.Dropdown(
|
available_voices = get_available_voices()
|
||||||
get_available_voices(), label="Default Voice", value=params["voice"]
|
default_voice = params["voice"]
|
||||||
)
|
# Check if the default voice is in the list of available voices
|
||||||
|
if default_voice not in available_voices:
|
||||||
|
# Handle the case where the default voice is not in the list (choose a default value or update it)
|
||||||
|
default_voice = available_voices[0] # Choose the first available voice as the default
|
||||||
|
# Add allow_custom_value=True to the Dropdown
|
||||||
|
voice = gr.Dropdown(available_voices, label="Default Voice", value=default_voice, allow_custom_value=True)
|
||||||
create_refresh_button(
|
create_refresh_button(
|
||||||
voice,
|
voice,
|
||||||
lambda: None,
|
lambda: None,
|
||||||
@@ -656,7 +661,7 @@ def ui():
|
|||||||
)
|
)
|
||||||
|
|
||||||
language = gr.Dropdown(
|
language = gr.Dropdown(
|
||||||
languages.keys(), label="Language", value=params["language"]
|
languages.keys(), label="Language", allow_custom_value=True, value=params["language"]
|
||||||
)
|
)
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
@@ -664,6 +669,7 @@ def ui():
|
|||||||
narrator_voice_gr = gr.Dropdown(
|
narrator_voice_gr = gr.Dropdown(
|
||||||
get_available_voices(),
|
get_available_voices(),
|
||||||
label="Narrator Voice",
|
label="Narrator Voice",
|
||||||
|
allow_custom_value=True,
|
||||||
value=params["narrator_voice"],
|
value=params["narrator_voice"],
|
||||||
)
|
)
|
||||||
create_refresh_button(
|
create_refresh_button(
|
||||||
|
|||||||
Reference in new issue
Block a user