ollui commited on
Commit
58333de
·
verified ·
1 Parent(s): d908294

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+ import uuid
4
+ import os
5
+
6
+ def chuvash_tts(text):
7
+ filename = f"/tmp/{uuid.uuid4()}.wav"
8
+ cmd = f'espeak-ng -v cv "{text}" -w {filename}'
9
+ subprocess.run(cmd, shell=True)
10
+ return filename
11
+
12
+ with gr.Blocks() as demo:
13
+ gr.Markdown("## Chuvash TTS using eSpeak NG")
14
+ with gr.Row():
15
+ inp = gr.Textbox(label="Nhập văn bản tiếng Chuvash")
16
+ out = gr.Audio(label="Phát âm", type="filepath")
17
+ btn = gr.Button("Chuyển thành giọng nói")
18
+ btn.click(fn=chuvash_tts, inputs=inp, outputs=out)
19
+
20
+ demo.launch()