cnph001 commited on
Commit
0596274
·
verified ·
1 Parent(s): 5f7c847

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -6,6 +6,7 @@ import tempfile
6
  import os
7
  import re # Import the regular expression module
8
 
 
9
  # Get all available voices
10
  async def get_voices():
11
  voices = await edge_tts.list_voices()
@@ -14,7 +15,7 @@ async def get_voices():
14
  # Text-to-speech function for a single paragraph
15
  async def paragraph_to_speech(text, voice, rate, pitch):
16
  voice1 ="en-US-AndrewNeural - en-US (Male)" #good for reading
17
- voice1F ="en-US-EmmaNeural - en-US" (Female)
18
  voice2 = "en-US-GuyNeural (Male)"
19
  voice2F = "en-US-JennyNeural (Female)"
20
  voice3 = "en-AU-WilliamNeural - en-AU (Male)"
@@ -95,7 +96,7 @@ import gradio as gr
95
 
96
  async def create_demo():
97
  voices = await get_voices()
98
-
99
  description = """
100
  Default = male, other voices 1F:US_Emma, 2F:US_Jenny, 3F:HK_Jan, 1M:US_Guy, 2M:AU_William, 1C: Childvoice
101
  Enter your text, select a voice, and adjust the speech rate and pitch.
@@ -106,7 +107,7 @@ async def create_demo():
106
  fn=tts_interface,
107
  inputs=[
108
  gr.Textbox(label="Input Text", lines=5, placeholder="Separate paragraphs with two blank lines."),
109
- gr.Dropdown(choices=[""] + list(voices.keys()), label="Select Voice", value=""),
110
  gr.Slider(minimum=-50, maximum=50, value=0, label="Speech Rate Adjustment (%)", step=1),
111
  gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
112
  ],
 
6
  import os
7
  import re # Import the regular expression module
8
 
9
+
10
  # Get all available voices
11
  async def get_voices():
12
  voices = await edge_tts.list_voices()
 
15
  # Text-to-speech function for a single paragraph
16
  async def paragraph_to_speech(text, voice, rate, pitch):
17
  voice1 ="en-US-AndrewNeural - en-US (Male)" #good for reading
18
+ voice1F ="en-US-EmmaNeural - en-US (Female)"
19
  voice2 = "en-US-GuyNeural (Male)"
20
  voice2F = "en-US-JennyNeural (Female)"
21
  voice3 = "en-AU-WilliamNeural - en-AU (Male)"
 
96
 
97
  async def create_demo():
98
  voices = await get_voices()
99
+ default_voice = "en-US-AndrewNeural - en-US (Male)" # 👈 Pick one of the available voices
100
  description = """
101
  Default = male, other voices 1F:US_Emma, 2F:US_Jenny, 3F:HK_Jan, 1M:US_Guy, 2M:AU_William, 1C: Childvoice
102
  Enter your text, select a voice, and adjust the speech rate and pitch.
 
107
  fn=tts_interface,
108
  inputs=[
109
  gr.Textbox(label="Input Text", lines=5, placeholder="Separate paragraphs with two blank lines."),
110
+ gr.Dropdown(choices=[""] + list(voices.keys()), label="Select Voice", value=default_voice),
111
  gr.Slider(minimum=-50, maximum=50, value=0, label="Speech Rate Adjustment (%)", step=1),
112
  gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
113
  ],