doevent commited on
Commit
c87b7a4
1 Parent(s): 752aa18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -10,11 +10,23 @@ logging.basicConfig(level=logging.INFO)
10
  api = TTS("tts_models/deu/fairseq/vits")
11
  count = 0
12
 
 
13
  def audio_tts(txt, audio_file):
14
- return {'cat': 0.3, 'dog': 0.7}
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- demo = gr.Interface(fn=image_classifier, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
17
- gr.Audio(source="upload", type="filepath", label="Input audio")],
18
  outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
19
 
20
  demo.queue(concurrency_count=1).launch(show_error=True)
 
10
  api = TTS("tts_models/deu/fairseq/vits")
11
  count = 0
12
 
13
+
14
  def audio_tts(txt, audio_file):
15
+ global count
16
+ count += 1
17
+ if count > 50:
18
+ time.sleep(5)
19
+ os.system("rm -R /tmp/*")
20
+ count = 0
21
+
22
+ api.tts_with_vc_to_file(txt,
23
+ speaker_wav=audio_file,
24
+ file_path="ouptut.wav")
25
+ return "ouptut.wav"
26
+
27
 
28
+ demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
29
+ gr.Audio(source="upload", type="filepath", label="Input audio")],
30
  outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
31
 
32
  demo.queue(concurrency_count=1).launch(show_error=True)