Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,14 +18,14 @@ async def text_to_speech(text, voice):
|
|
| 18 |
voice_short_name = voice.split(" - ")[0]
|
| 19 |
rate_str = f"+0%"
|
| 20 |
pitch_str = f"+0Hz"
|
| 21 |
-
communicate = edge_tts.Communicate(text, voice_short_name,
|
| 22 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 23 |
tmp_path = tmp_file.name
|
| 24 |
await communicate.save(tmp_path)
|
| 25 |
return tmp_path, None
|
| 26 |
|
| 27 |
async def tts_interface(text, voice):
|
| 28 |
-
audio, warning = await text_to_speech(text, voice
|
| 29 |
if warning:
|
| 30 |
return audio, gr.Warning(warning)
|
| 31 |
return audio, None
|
|
|
|
| 18 |
voice_short_name = voice.split(" - ")[0]
|
| 19 |
rate_str = f"+0%"
|
| 20 |
pitch_str = f"+0Hz"
|
| 21 |
+
communicate = edge_tts.Communicate(text, voice_short_name, rate_str, pitch_str)
|
| 22 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 23 |
tmp_path = tmp_file.name
|
| 24 |
await communicate.save(tmp_path)
|
| 25 |
return tmp_path, None
|
| 26 |
|
| 27 |
async def tts_interface(text, voice):
|
| 28 |
+
audio, warning = await text_to_speech(text, voice)
|
| 29 |
if warning:
|
| 30 |
return audio, gr.Warning(warning)
|
| 31 |
return audio, None
|