Musawir19 commited on
Commit
a972636
·
verified ·
1 Parent(s): b1e63d9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -18,8 +18,11 @@ st.success("Models loaded successfully!")
18
  def text_to_speech(text):
19
  # Generate mel spectrogram
20
  mel_output, mel_length, alignment = tacotron2.encode_text(text)
 
21
  # Decode mel spectrogram to waveform
 
22
  waveforms = hifi_gan.decode_batch(mel_output)
 
23
  # Save waveform as audio file
24
  audio_path = "output.wav"
25
  write(audio_path, 22050, waveforms.squeeze(1).cpu().numpy())
 
18
  def text_to_speech(text):
19
  # Generate mel spectrogram
20
  mel_output, mel_length, alignment = tacotron2.encode_text(text)
21
+
22
  # Decode mel spectrogram to waveform
23
+ # FIX: hifi_gan.decode_batch() returns only 1 value
24
  waveforms = hifi_gan.decode_batch(mel_output)
25
+
26
  # Save waveform as audio file
27
  audio_path = "output.wav"
28
  write(audio_path, 22050, waveforms.squeeze(1).cpu().numpy())