Update app.py
Browse files
app.py
CHANGED
@@ -154,12 +154,13 @@ if STATEMENT:
|
|
154 |
audio_data = speech['waveform']
|
155 |
|
156 |
# Optional: Save the audio to a file (uncomment if needed)
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
|
161 |
# Optional: Play the audio directly in Streamlit (uncomment if needed)
|
162 |
-
|
|
|
163 |
|
164 |
st.sidebar.write('Text converted to speech')
|
165 |
else:
|
|
|
154 |
audio_data = speech['waveform']
|
155 |
|
156 |
# Optional: Save the audio to a file (uncomment if needed)
|
157 |
+
sd.write(audio_data, samplerate=speech['sampling_rate']) # Adjust samplerate if necessary
|
158 |
+
with open("sample_tts.wav", "wb") as f:
|
159 |
+
f.write(audio_data)
|
160 |
|
161 |
# Optional: Play the audio directly in Streamlit (uncomment if needed)
|
162 |
+
# Huggingface does not have direct access to the generated audio data
|
163 |
+
# sd.play(audio_data, samplerate=speech['sampling_rate']) # Adjust samplerate if necessary
|
164 |
|
165 |
st.sidebar.write('Text converted to speech')
|
166 |
else:
|