Update app.py
Browse files
app.py
CHANGED
@@ -12,9 +12,9 @@ async def get_voices():
|
|
12 |
# Text-to-speech function
|
13 |
async def text_to_speech(text, voice, rate, pitch):
|
14 |
if not text.strip():
|
15 |
-
return None, gr.Warning("
|
16 |
if not voice:
|
17 |
-
return None, gr.Warning("
|
18 |
|
19 |
voice_short_name = voice.split(" - ")[0]
|
20 |
rate_str = f"{rate:+d}%"
|
@@ -44,18 +44,18 @@ async def create_demo():
|
|
44 |
demo = gr.Interface(
|
45 |
fn=tts_interface,
|
46 |
inputs=[
|
47 |
-
gr.Textbox(label="
|
48 |
-
gr.Dropdown(choices=[""] + list(voices.keys()), label="
|
49 |
gr.Slider(minimum=-50, maximum=50, value=0, label="Speech Rate Adjustment (%)", step=1),
|
50 |
gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
|
51 |
],
|
52 |
outputs=[
|
53 |
-
gr.Audio(label="
|
54 |
gr.Markdown(label="Warning", visible=False)
|
55 |
],
|
56 |
-
title="
|
57 |
description=description,
|
58 |
-
article="
|
59 |
analytics_enabled=False,
|
60 |
allow_flagging=False
|
61 |
)
|
|
|
12 |
# Text-to-speech function
|
13 |
async def text_to_speech(text, voice, rate, pitch):
|
14 |
if not text.strip():
|
15 |
+
return None, gr.Warning("Nhập dzăn bản cần chuyển thành voice.")
|
16 |
if not voice:
|
17 |
+
return None, gr.Warning("Chọn dzọng nói.")
|
18 |
|
19 |
voice_short_name = voice.split(" - ")[0]
|
20 |
rate_str = f"{rate:+d}%"
|
|
|
44 |
demo = gr.Interface(
|
45 |
fn=tts_interface,
|
46 |
inputs=[
|
47 |
+
gr.Textbox(label="Nhập dzăn bản", lines=5),
|
48 |
+
gr.Dropdown(choices=[""] + list(voices.keys()), label="Chọn dzọng nói", value=""),
|
49 |
gr.Slider(minimum=-50, maximum=50, value=0, label="Speech Rate Adjustment (%)", step=1),
|
50 |
gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
|
51 |
],
|
52 |
outputs=[
|
53 |
+
gr.Audio(label="File voice nè", type="filepath"),
|
54 |
gr.Markdown(label="Warning", visible=False)
|
55 |
],
|
56 |
+
title="KevinK: Công cụ Chuyển dzăn bản thành file audio nha.",
|
57 |
description=description,
|
58 |
+
article="Đại khái là công cụ này dùng chức năng text to speech có trong trình duyệt MS Edge",
|
59 |
analytics_enabled=False,
|
60 |
allow_flagging=False
|
61 |
)
|