akhaliq HF staff commited on
Commit
bcb66b7
1 Parent(s): fe513e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -35,16 +35,16 @@ def inference(text):
35
  lengths = lengths.to(device)
36
  spec, _, _ = tacotron2.infer(processed, lengths)
37
 
38
-
39
 
40
  with torch.no_grad():
41
  waveforms = waveglow.infer(spec)
42
 
43
  torchaudio.save("output_waveglow.wav", waveforms[0:1].cpu(), sample_rate=22050)
44
- return "output_waveglow.wav",spec[0].cpu().detach().numpy()
45
 
46
  title="TACOTRON 2"
47
  description="Gradio demo for TACOTRON 2: The Tacotron 2 model for generating mel spectrograms from text. To use it, simply add you text or click on one of the examples to load them. Read more at the links below."
48
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1712.05884' target='_blank'>Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions</a> | <a href='https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/SpeechSynthesis/Tacotron2' target='_blank'>Github Repo</a></p>"
49
  examples=[["life is like a box of chocolates"]]
50
- gr.Interface(inference,"text",[gr.outputs.Audio(type="file"),gr.outputs.Image(type="numpy",label="Spectrogram")],title=title,description=description,article=article,examples=examples).launch(enable_queue=True)
 
35
  lengths = lengths.to(device)
36
  spec, _, _ = tacotron2.infer(processed, lengths)
37
 
38
+ plt.imshow(spec[0].cpu().detach())
39
 
40
  with torch.no_grad():
41
  waveforms = waveglow.infer(spec)
42
 
43
  torchaudio.save("output_waveglow.wav", waveforms[0:1].cpu(), sample_rate=22050)
44
+ return "output_waveglow.wav",plt
45
 
46
  title="TACOTRON 2"
47
  description="Gradio demo for TACOTRON 2: The Tacotron 2 model for generating mel spectrograms from text. To use it, simply add you text or click on one of the examples to load them. Read more at the links below."
48
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1712.05884' target='_blank'>Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions</a> | <a href='https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/SpeechSynthesis/Tacotron2' target='_blank'>Github Repo</a></p>"
49
  examples=[["life is like a box of chocolates"]]
50
+ gr.Interface(inference,"text",[gr.outputs.Audio(type="file"),gr.outputs.Image(type="plot",label="Spectrogram")],title=title,description=description,article=article,examples=examples).launch(enable_queue=True)