Spaces:
Runtime error
Runtime error
File size: 1,055 Bytes
75612b7 1994c9d 75612b7 e5b11bc 0be5396 eba8cc6 75612b7 2f32e34 e5b11bc 2f32e34 3b97565 2f32e34 e9af981 adafcbb 75612b7 1f961c9 75612b7 276a180 75612b7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
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) |