saq1b commited on
Commit
2b44b26
1 Parent(s): 1415608

Speaker Voice dropdown

Browse files
Files changed (1) hide show
  1. app.py +31 -21
app.py CHANGED
@@ -289,9 +289,19 @@ class TextExtractor:
289
  raise ValueError(f"Unsupported file type: {file_extension}")
290
 
291
  async def process_input(input_text: str, input_file, language: str, speaker1: str, speaker2: str) -> str:
292
- # Remove the gender from the speaker name
293
- speaker1 = speaker1.split()[0]
294
- speaker2 = speaker2.split()[0]
 
 
 
 
 
 
 
 
 
 
295
 
296
  if input_file:
297
  input_text = await TextExtractor.extract_text(input_file.name)
@@ -322,27 +332,27 @@ iface = gr.Interface(
322
  ],
323
  value="English"),
324
  gr.Dropdown(label="Speaker 1 Voice", choices=[
325
- "en-US-AndrewMultilingualNeural (Male)",
326
- "en-US-AvaMultilingualNeural (Female)",
327
- "en-US-BrianMultilingualNeural (Male)",
328
- "en-US-EmmaMultilingualNeural (Female)",
329
- "de-DE-FlorianMultilingualNeural (Male)",
330
- "de-DE-SeraphinaMultilingualNeural (Female)",
331
- "fr-FR-RemyMultilingualNeural (Male)",
332
- "fr-FR-VivienneMultilingualNeural (Female)",
333
  ],
334
- value="en-US-AndrewMultilingualNeural (Male)"),
335
  gr.Dropdown(label="Speaker 2 Voice", choices=[
336
- "en-US-AndrewMultilingualNeural (Male)",
337
- "en-US-AvaMultilingualNeural (Female)",
338
- "en-US-BrianMultilingualNeural (Male)",
339
- "en-US-EmmaMultilingualNeural (Female)",
340
- "de-DE-FlorianMultilingualNeural (Male)",
341
- "de-DE-SeraphinaMultilingualNeural (Female)",
342
- "fr-FR-RemyMultilingualNeural (Male)",
343
- "fr-FR-VivienneMultilingualNeural (Female)",
344
  ],
345
- value="en-US-AvaMultilingualNeural (Female)")
346
  ],
347
  outputs=[
348
  gr.Audio(label="Generated Podcast Audio")
 
289
  raise ValueError(f"Unsupported file type: {file_extension}")
290
 
291
  async def process_input(input_text: str, input_file, language: str, speaker1: str, speaker2: str) -> str:
292
+ voice_names = {
293
+ "Andrew - English (United States)": "en-US-AndrewMultilingualNeural",
294
+ "Ava - English (United States)": "en-US-AvaMultilingualNeural",
295
+ "Brian - English (United States)": "en-US-BrianMultilingualNeural",
296
+ "Emma - English (United States)": "en-US-EmmaMultilingualNeural",
297
+ "Florian - German (Germany)": "de-DE-FlorianMultilingualNeural",
298
+ "Seraphina - German (Germany)": "de-DE-SeraphinaMultilingualNeural",
299
+ "Remy - French (France)": "fr-FR-RemyMultilingualNeural",
300
+ "Vivienne - French (France)": "fr-FR-VivienneMultilingualNeural"
301
+ }
302
+
303
+ speaker1 = voice_names[speaker1]
304
+ speaker2 = voice_names[speaker2]
305
 
306
  if input_file:
307
  input_text = await TextExtractor.extract_text(input_file.name)
 
332
  ],
333
  value="English"),
334
  gr.Dropdown(label="Speaker 1 Voice", choices=[
335
+ "Andrew - English (United States)",
336
+ "Ava - English (United States)",
337
+ "Brian - English (United States)",
338
+ "Emma - English (United States)",
339
+ "Florian - German (Germany)",
340
+ "Seraphina - German (Germany)",
341
+ "Remy - French (France)",
342
+ "Vivienne - French (France)"
343
  ],
344
+ value="Andrew - English (United States)"),
345
  gr.Dropdown(label="Speaker 2 Voice", choices=[
346
+ "Andrew - English (United States)",
347
+ "Ava - English (United States)",
348
+ "Brian - English (United States)",
349
+ "Emma - English (United States)",
350
+ "Florian - German (Germany)",
351
+ "Seraphina - German (Germany)",
352
+ "Remy - French (France)",
353
+ "Vivienne - French (France)"
354
  ],
355
+ value="Ava - English (United States)")
356
  ],
357
  outputs=[
358
  gr.Audio(label="Generated Podcast Audio")