Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
@@ -421,7 +421,14 @@ from gradio_client import Client
|
|
421 |
client = Client('hexgrad/kokoro-src', hf_token=os.environ['SRC'])
|
422 |
def preview(text, voice, speed, trim, sk):
|
423 |
assert sk == os.environ['SK'], ('❌', datetime.now(), text, voice, sk)
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
with gr.Blocks() as preview_tts:
|
427 |
with gr.Row():
|
|
|
421 |
client = Client('hexgrad/kokoro-src', hf_token=os.environ['SRC'])
|
422 |
def preview(text, voice, speed, trim, sk):
|
423 |
assert sk == os.environ['SK'], ('❌', datetime.now(), text, voice, sk)
|
424 |
+
try:
|
425 |
+
audio = client.predict(text=text, voice=voice, speed=speed, trim=trim, use_gpu=True, sk=sk, api_name='/generate')[0]
|
426 |
+
except Exception as e:
|
427 |
+
print('📡', datetime.now(), text, voice, repr(e))
|
428 |
+
gr.Warning('v0.22 unavailable')
|
429 |
+
gr.Info('Switching to v0.19')
|
430 |
+
audio = generate(text, voice=voice, speed=speed, trim=trim, sk=sk)
|
431 |
+
return audio
|
432 |
|
433 |
with gr.Blocks() as preview_tts:
|
434 |
with gr.Row():
|