doevent commited on
Commit
72d900d
·
1 Parent(s): 90a5c93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -6,7 +6,7 @@ import time
6
  count = 0
7
 
8
 
9
- def audio_tts(txt, audio_file):
10
  global count
11
  count += 1
12
  if count > 50:
@@ -15,14 +15,14 @@ def audio_tts(txt, audio_file):
15
  count = 0
16
 
17
  # TTS with on the fly voice conversion
18
- api = TTS("tts_models/rus/fairseq/vits", gpu=False)
19
  api.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
20
  return "ouptut.wav"
21
 
22
 
23
  demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
 
24
  gr.Audio(source="upload", type="filepath", label="Input audio")],
25
  outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
26
 
27
  demo.queue(concurrency_count=1).launch(show_error=True)
28
-
 
6
  count = 0
7
 
8
 
9
+ def audio_tts(txt, language, audio_file):
10
  global count
11
  count += 1
12
  if count > 50:
 
15
  count = 0
16
 
17
  # TTS with on the fly voice conversion
18
+ api = TTS(f"tts_models/{language}/fairseq/vits", gpu=False)
19
  api.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
20
  return "ouptut.wav"
21
 
22
 
23
  demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
24
+ gr.Textbox(label="Language", value="rus"),
25
  gr.Audio(source="upload", type="filepath", label="Input audio")],
26
  outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
27
 
28
  demo.queue(concurrency_count=1).launch(show_error=True)