text-generation-webui icon indicating copy to clipboard operation
text-generation-webui copied to clipboard

Add French TTS

Open johngtrs opened this issue 1 year ago • 1 comments

I tried to update TTS voice dropdown with another "TTS Language" dropdown but I don't know how to update the choices list Dropdown in Gradio.

So, I'm sorry for this bad code :/

johngtrs avatar Apr 15 '23 16:04 johngtrs

Personally, I would build a map of models, languages, and speakers, so that we don't have args cluttered with irrelevant options. Silero is also not the only TTS system, so making args that are only relevant to it is not good.

Gradio dropdowns are pretty easy (note: this is pseudocode and isn't done):

model_dropdown = gr.Dropdown(value=params['model_id'], choices=models, label='Model')
speaker_dropdown = gr.Dropdown(value=params['speaker'], choices=speakers['model_id'], label='Speaker')

model_dropdown.change(lambda x: update_model(x), model_dropdown, speaker_dropdown)
speaker_dropdown.change(lambda x: params.update({"speaker": x}), speaker_dropdown, None)

def update_model(x):
    global params, language, speaker
    params.update({"model_id": x})
    # update language
    language = pull it from a map or something
    # update speakers
    speaker = find a default speaker for the model and set it
    return gr.update(value=speaker, choices=speakers['model_id'])

da3dsoul avatar Apr 15 '23 23:04 da3dsoul