djanssen79 commited on
Commit
4cf4259
·
verified ·
1 Parent(s): 84b42c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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, rate=rate_str, pitch=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, rate, pitch)
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