Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,11 @@ if text:
|
|
21 |
mel_outputs = tts_model.encode_batch(text)
|
22 |
waveforms = hifi_gan.decode_batch(mel_outputs)
|
23 |
|
24 |
-
waveform = waveforms[0].squeeze(1)
|
|
|
|
|
|
|
|
|
25 |
|
26 |
# Display the audio widget to play the synthesized speech
|
27 |
-
st.audio(waveform
|
|
|
21 |
mel_outputs = tts_model.encode_batch(text)
|
22 |
waveforms = hifi_gan.decode_batch(mel_outputs)
|
23 |
|
24 |
+
waveform = waveforms[0].squeeze(1).numpy()
|
25 |
+
|
26 |
+
# Normalize the waveform to the range [-1, 1] if necessary
|
27 |
+
if np.max(np.abs(waveform)) > 1.0:
|
28 |
+
waveform /= np.max(np.abs(waveform))
|
29 |
|
30 |
# Display the audio widget to play the synthesized speech
|
31 |
+
st.audio(waveform, format="audio/wav", sample_rate = 22050)
|