latest
Browse files- app.py +21 -0
- hello selamat pagi semua.mp3 +0 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from gtts import gTTS
|
| 3 |
+
from gtts.langs import _main_langs
|
| 4 |
+
def update(text,lang):
|
| 5 |
+
test = gTTS(text,lang=lang)
|
| 6 |
+
out = f"{text}.mp3"
|
| 7 |
+
test.save(out)
|
| 8 |
+
return out
|
| 9 |
+
|
| 10 |
+
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown("Start typing below and then click **Run** to see the output.")
|
| 12 |
+
with gr.Blocks() as b:
|
| 13 |
+
with gr.Column():
|
| 14 |
+
text = gr.Textbox()
|
| 15 |
+
lang = gr.Dropdown(choices=list(_main_langs().keys()),value="ms")
|
| 16 |
+
with gr.Column():
|
| 17 |
+
output = gr.Audio()
|
| 18 |
+
btn = gr.Button("Run")
|
| 19 |
+
btn.click(fn=update, inputs=[text,lang], outputs=output)
|
| 20 |
+
|
| 21 |
+
demo.launch()
|
hello selamat pagi semua.mp3
ADDED
|
Binary file (10.9 kB). View file
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gTTS
|
| 2 |
+
gradio
|