mrfakename commited on
Commit
bb53d91
·
verified ·
1 Parent(s): 6a8f586

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -1,5 +1,7 @@
1
  print("import gradio")
2
  import gradio as gr
 
 
3
  print("import ppn")
4
  from pypinyin import lazy_pinyin, Style
5
  print("import torch")
@@ -80,7 +82,9 @@ def speak(text):
80
  diffusion_conditioning = normalize_tacotron_mel(cond_mel)
81
  mel = do_spectrogram_diffusion(diffusion, diffuser, latent, diffusion_conditioning, temperature=1.0).detach().cpu()
82
  wav = vocos.decode(mel)
83
- return (24000, wav.detach().cpu())
 
 
84
 
85
  with gr.Blocks() as demo:
86
  gr.Markdown('# TTTS\n\nAn **unofficial** demo of [TTTS](https://github.com/adelacvg/ttts) based on XTTS. TTTS only supports Chinese.')
 
1
  print("import gradio")
2
  import gradio as gr
3
+ from scipy.io.wavfile import write
4
+ import tempfile
5
  print("import ppn")
6
  from pypinyin import lazy_pinyin, Style
7
  print("import torch")
 
82
  diffusion_conditioning = normalize_tacotron_mel(cond_mel)
83
  mel = do_spectrogram_diffusion(diffusion, diffuser, latent, diffusion_conditioning, temperature=1.0).detach().cpu()
84
  wav = vocos.decode(mel)
85
+ with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as f:
86
+ write(f.name, data=wav, rate=24000)
87
+ return f.name
88
 
89
  with gr.Blocks() as demo:
90
  gr.Markdown('# TTTS\n\nAn **unofficial** demo of [TTTS](https://github.com/adelacvg/ttts) based on XTTS. TTTS only supports Chinese.')