fix: elevenlabs cloned voices do not show up in webui after entering API key (#2107)

This commit is contained in:
pixel 2023-05-16 17:21:36 -06:00 committed by GitHub
parent 7584d46c29
commit 458a627ab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,12 @@ voices = None
wav_idx = 0 wav_idx = 0
def update_api_key(key):
params['api_key'] = key
if key is not None:
elevenlabs.set_api_key(key)
def refresh_voices(): def refresh_voices():
global params global params
your_voices = elevenlabs.voices() your_voices = elevenlabs.voices()
@ -167,7 +173,7 @@ def ui():
# Event functions to update the parameters in the backend # Event functions to update the parameters in the backend
activate.change(lambda x: params.update({'activate': x}), activate, None) activate.change(lambda x: params.update({'activate': x}), activate, None)
voice.change(lambda x: params.update({'selected_voice': x}), voice, None) voice.change(lambda x: params.update({'selected_voice': x}), voice, None)
api_key.change(lambda x: params.update({'api_key': x}), api_key, None) api_key.change(update_api_key, api_key, None)
# connect.click(check_valid_api, [], connection_status) # connect.click(check_valid_api, [], connection_status)
refresh.click(refresh_voices_dd, [], voice) refresh.click(refresh_voices_dd, [], voice)
# Event functions to update the parameters in the backend # Event functions to update the parameters in the backend