abdel1111 commited on
Commit
6133c06
1 Parent(s): 5d8ec27

Adding multiple language support

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -10,25 +10,26 @@ device = "cuda"
10
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
11
 
12
  @spaces.GPU(enable_queue=True)
13
- def clone(text, audio):
14
- tts.tts_to_file(text=text, speaker_wav=audio, language="en", file_path="./output.wav")
15
  return "./output.wav"
16
 
17
  iface = gr.Interface(fn=clone,
18
- inputs=[gr.Textbox(label='Text'),gr.Audio(type='filepath', label='Voice reference audio file')],
 
 
19
  outputs=gr.Audio(type='filepath'),
20
  title='Voice Clone',
21
  description="""
22
  by [Tony Assi](https://www.tonyassi.com/)
23
-
24
  This space uses xtts_v2 model. Non-commercial use only. [Coqui Public Model License](https://coqui.ai/cpml)
25
 
26
  Please ❤️ this Space. <a href="mailto: tony.assi.media@gmail.com">Email me</a>.
27
  """,
28
  theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"),
29
- examples=[["Hey! It's me Dorthy, from the Wizard of Oz. Type in whatever you'd like me to say.","./audio/Wizard-of-Oz-Dorthy.wav"],
30
- ["It's me Vito Corleone, from the Godfather. Type in whatever you'd like me to say.","./audio/Godfather.wav"],
31
- ["Hey, it's me Paris Hilton. Type in whatever you'd like me to say.","./audio/Paris-Hilton.mp3"],
32
- ["Hey, it's me Megan Fox from Transformers. Type in whatever you'd like me to say.","./audio/Megan-Fox.mp3"],
33
- ["Hey there, it's me Jeff Goldblum. Type in whatever you'd like me to say.","./audio/Jeff-Goldblum.mp3"],])
34
  iface.launch()
 
10
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
11
 
12
  @spaces.GPU(enable_queue=True)
13
+ def clone(text, audio, language):
14
+ tts.tts_to_file(text=text, speaker_wav=audio, language=language, file_path="./output.wav")
15
  return "./output.wav"
16
 
17
  iface = gr.Interface(fn=clone,
18
+ inputs=[gr.Textbox(label='Text'),
19
+ gr.Audio(type='filepath', label='Voice reference audio file'),
20
+ gr.Dropdown(label='Language', choices=['en - English', 'fr - French', 'ar - Arabic', 'es - Spanish', 'zh - Chinese', 'ru - Russian', 'pt - Portuguese', 'it - Italian', 'de - German', 'nl - Dutch'])],
21
  outputs=gr.Audio(type='filepath'),
22
  title='Voice Clone',
23
  description="""
24
  by [Tony Assi](https://www.tonyassi.com/)
 
25
  This space uses xtts_v2 model. Non-commercial use only. [Coqui Public Model License](https://coqui.ai/cpml)
26
 
27
  Please ❤️ this Space. <a href="mailto: tony.assi.media@gmail.com">Email me</a>.
28
  """,
29
  theme = gr.themes.Base(primary_hue="teal",secondary_hue="teal",neutral_hue="slate"),
30
+ examples=[["Hey! It's me Dorthy, from the Wizard of Oz. Type in whatever you'd like me to say.","./audio/Wizard-of-Oz-Dorthy.wav", "en - English"],
31
+ ["It's me Vito Corleone, from the Godfather. Type in whatever you'd like me to say.","./audio/Godfather.wav", "en - English"],
32
+ ["Hey, it's me Paris Hilton. Type in whatever you'd like me to say.","./audio/Paris-Hilton.mp3", "en - English"],
33
+ ["Hey, it's me Megan Fox from Transformers. Type in whatever you'd like me to say.","./audio/Megan-Fox.mp3", "en - English"],
34
+ ["Hey there, it's me Jeff Goldblum. Type in whatever you'd like me to say.","./audio/Jeff-Goldblum.mp3", "en - English"],])
35
  iface.launch()