Eugene Siow commited on
Commit
af5b6e9
1 Parent(s): e7f29e7

Add fix to output tempfile. Better quality.

Browse files
Files changed (2) hide show
  1. app.py +7 -3
  2. gradio_queue.db +0 -0
app.py CHANGED
@@ -1,5 +1,6 @@
 
1
  import gradio as gr
2
- import numpy as np
3
  from TTS.utils.manage import ModelManager
4
  from TTS.utils.synthesizer import Synthesizer
5
 
@@ -23,8 +24,11 @@ synthesizer = Synthesizer(
23
 
24
  def inference(text: str):
25
  wavs = synthesizer.tts(text)
26
- output = (synthesizer.output_sample_rate, np.array(wavs).astype(np.float32))
27
- return output
 
 
 
28
 
29
 
30
  gr.Interface(
 
1
+ import tempfile
2
  import gradio as gr
3
+ # import numpy as np
4
  from TTS.utils.manage import ModelManager
5
  from TTS.utils.synthesizer import Synthesizer
6
 
 
24
 
25
  def inference(text: str):
26
  wavs = synthesizer.tts(text)
27
+ # output = (synthesizer.output_sample_rate, np.array(wavs).astype(np.float32))
28
+ # return output
29
+ with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
30
+ synthesizer.save_wav(wavs, fp)
31
+ return fp.name
32
 
33
 
34
  gr.Interface(
gradio_queue.db CHANGED
Binary files a/gradio_queue.db and b/gradio_queue.db differ