TGPro1 commited on
Commit
569c1ca
·
verified ·
1 Parent(s): 78e0477

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -9,14 +9,16 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
9
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
10
 
11
  def clone(text, lang, ref):
12
- out = "out.wav"
13
- tts.tts_to_file(text=text, file_path=out, speaker_wav=ref, language=lang)
14
- return out
15
 
16
- with gr.Blocks() as demo:
17
- t=gr.Textbox()
18
- l=gr.Dropdown(["fr","en","es","de","it"],value="fr")
19
- r=gr.Audio(type="filepath")
20
- o=gr.Audio()
21
- gr.Button("Go").click(clone, [t,l,r], [o])
22
- demo.launch()
 
 
 
9
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
10
 
11
  def clone(text, lang, ref):
12
+ out = "out.wav"
13
+ tts.tts_to_file(text=text, file_path=out, speaker_wav=ref, language=lang)
14
+ return out
15
 
16
+ LANGS = ["en","es","fr","de","it","pt","pl","tr","ru","nl","cs","ar","zh-cn","ja","ko","hu"]
17
+
18
+ with gr.Blocks() as demo:
19
+ t=gr.Textbox(label="Text")
20
+ l=gr.Dropdown(label="Lang", choices=LANGS, value="fr")
21
+ r=gr.Audio(label="Ref", type="filepath")
22
+ o=gr.Audio(label="Out")
23
+ gr.Button("Generate").click(clone, [t,l,r], [o])
24
+ demo.launch()