Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -444,8 +444,7 @@ language_dict = {
|
|
| 444 |
|
| 445 |
client = Client("MohamedRashad/arabic-auto-tashkeel")
|
| 446 |
|
| 447 |
-
|
| 448 |
-
async def text_to_speech_edge(text, language_code, speaker, rate, pitch, tashkeel_checkbox=False ):
|
| 449 |
|
| 450 |
# Remove diacritics from Arabic text then add tashkeel
|
| 451 |
if language_code == "Arabic" and tashkeel_checkbox:
|
|
@@ -455,10 +454,8 @@ async def text_to_speech_edge(text, language_code, speaker, rate, pitch, tashkee
|
|
| 455 |
)
|
| 456 |
|
| 457 |
# Get the voice for the selected language and speaker
|
| 458 |
-
rate_str = f"{rate:+d}%"
|
| 459 |
-
pitch_str = f"{pitch:+d}Hz"
|
| 460 |
voice = language_dict[language_code][speaker]
|
| 461 |
-
communicate = edge_tts.Communicate(text, voice
|
| 462 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 463 |
tmp_path = tmp_file.name
|
| 464 |
await communicate.save(tmp_path)
|
|
@@ -488,9 +485,6 @@ with gr.Blocks(title="Multilingual TTS") as demo:
|
|
| 488 |
speaker = gr.Dropdown(choices=[], value=default_speaker, label="Speakers", interactive=False)
|
| 489 |
tashkeel_checkbox = gr.Checkbox(label="Tashkeel", value=False, visible=False, interactive=False)
|
| 490 |
run_btn = gr.Button(value="Generate Audio", variant="primary")
|
| 491 |
-
|
| 492 |
-
gr.Slider(minimum=-50, maximum=50, value=0, label="Speech Rate Adjustment (%)", step=1),
|
| 493 |
-
gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
|
| 494 |
|
| 495 |
with gr.Column():
|
| 496 |
output_text = gr.Textbox(label="Output Text")
|
|
|
|
| 444 |
|
| 445 |
client = Client("MohamedRashad/arabic-auto-tashkeel")
|
| 446 |
|
| 447 |
+
async def text_to_speech_edge(text, language_code, speaker, tashkeel_checkbox=False):
|
|
|
|
| 448 |
|
| 449 |
# Remove diacritics from Arabic text then add tashkeel
|
| 450 |
if language_code == "Arabic" and tashkeel_checkbox:
|
|
|
|
| 454 |
)
|
| 455 |
|
| 456 |
# Get the voice for the selected language and speaker
|
|
|
|
|
|
|
| 457 |
voice = language_dict[language_code][speaker]
|
| 458 |
+
communicate = edge_tts.Communicate(text, voice)
|
| 459 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 460 |
tmp_path = tmp_file.name
|
| 461 |
await communicate.save(tmp_path)
|
|
|
|
| 485 |
speaker = gr.Dropdown(choices=[], value=default_speaker, label="Speakers", interactive=False)
|
| 486 |
tashkeel_checkbox = gr.Checkbox(label="Tashkeel", value=False, visible=False, interactive=False)
|
| 487 |
run_btn = gr.Button(value="Generate Audio", variant="primary")
|
|
|
|
|
|
|
|
|
|
| 488 |
|
| 489 |
with gr.Column():
|
| 490 |
output_text = gr.Textbox(label="Output Text")
|