Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,38 @@
|
|
|
|
|
|
1 |
import os
|
2 |
-
|
3 |
-
os.
|
4 |
|
5 |
-
import gradio as gr
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
interface.launch()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import sys
|
3 |
import os
|
4 |
+
from gradio_client import Client
|
5 |
+
HF_TOKEN = os.getenv('HF_TOKEN')
|
6 |
|
|
|
7 |
|
8 |
+
examples=[
|
9 |
+
["چۆنیەتیی خواردنی دەرمانی شەکرە لە مانگی رەمەزاندا"],
|
10 |
+
["ئێمباپێ هێشتا نەچووەتە ریال مەدرید کێشە بۆ ئاتلێتیکۆ مەدرید دروست دەکات"],
|
11 |
+
]
|
12 |
+
|
13 |
+
client = Client("Karzan/Barnammer-TTS",hf_token=HF_TOKEN)
|
14 |
+
|
15 |
+
def tts(text: str):
|
16 |
+
# synthesize
|
17 |
+
result = client.predict(
|
18 |
+
text=text,
|
19 |
+
api_name="/predict"
|
20 |
+
)
|
21 |
+
return result
|
22 |
+
|
23 |
+
iface = gr.Interface(
|
24 |
+
fn=tts,
|
25 |
+
inputs=[
|
26 |
+
gr.Textbox(
|
27 |
+
label="Text",
|
28 |
+
value="خوێندنەوەی دەق بە دەنگی بەختیار",
|
29 |
+
),
|
30 |
+
|
31 |
+
],
|
32 |
+
outputs=gr.Audio(label="Output",type='filepath'),
|
33 |
+
examples=examples,
|
34 |
+
title="🗣️ Barnammer-TTS 🗣️",
|
35 |
+
live=False
|
36 |
+
)
|
37 |
|
38 |
+
iface.launch(share=False)
|
|