hivecorp commited on
Commit
f62d4ae
·
verified ·
1 Parent(s): 18dfe86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ from moviepy.editor import AudioFileClip
8
  # Get all available voices
9
  async def get_voices():
10
  voices = await edge_tts.list_voices()
11
- return {f"{v['ShortName']} - {v['Locale']} ({v['Gender']})": v['ShortName'] for v in voices}
12
 
13
  # Text to speech functionality
14
  async def text_to_speech(text, voice, rate, pitch):
@@ -17,7 +17,7 @@ async def text_to_speech(text, voice, rate, pitch):
17
  if not voice:
18
  return None, gr.Warning("Please select a voice.")
19
 
20
- voice_short_name = voice.split(" - ")[0]
21
  rate_str = f"{rate:+d}%"
22
  pitch_str = f"{pitch:+d}Hz"
23
  communicate = edge_tts.Communicate(text, voice_short_name, rate=rate_str, pitch=pitch_str)
 
8
  # Get all available voices
9
  async def get_voices():
10
  voices = await edge_tts.list_voices()
11
+ return {f"{v['ShortName']} ({v['Locale']}, {v['Gender']})": v['ShortName'] for v in voices}
12
 
13
  # Text to speech functionality
14
  async def text_to_speech(text, voice, rate, pitch):
 
17
  if not voice:
18
  return None, gr.Warning("Please select a voice.")
19
 
20
+ voice_short_name = voice.split(" (")[0]
21
  rate_str = f"{rate:+d}%"
22
  pitch_str = f"{pitch:+d}Hz"
23
  communicate = edge_tts.Communicate(text, voice_short_name, rate=rate_str, pitch=pitch_str)