Spaces:
Runtime error
Runtime error
import gradio as gr | |
import sys | |
import os | |
from gradio_client import Client | |
HF_TOKEN = os.getenv('HF_TOKEN') | |
API_URL = os.getenv('API_URL') | |
examples=[ | |
["چۆنیەتیی خواردنی دەرمانی شەکرە لە مانگی رەمەزاندا"], | |
["ئێمباپێ هێشتا نەچووەتە ریال مەدرید کێشە بۆ ئاتلێتیکۆ مەدرید دروست دەکات"], | |
] | |
def tts(text: str): | |
# synthesize | |
try: | |
client = Client(API_URL,hf_token=HF_TOKEN) | |
result = client.predict( | |
text=text, | |
api_name="/predict" | |
) | |
return result[0] | |
except Exception as e: | |
print(e) | |
raise gr.Error(e) | |
iface = gr.Interface( | |
fn=tts, | |
inputs=[ | |
gr.Textbox( | |
label="Text", | |
value="خوێندنەوەی دەق بە دەنگی بەختیار", | |
), | |
], | |
outputs=gr.Audio(label="Output",type='filepath'), | |
examples=examples, | |
title="Barnammer (Central Kurdish TTS)", | |
live=False | |
) | |
iface.launch(share=False) |