richardorama
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -153,15 +153,16 @@ if STATEMENT:
|
|
153 |
# Access the audio waveform from the dictionary (assuming key name is 'audio')
|
154 |
audio_data = speech['audio']
|
155 |
|
156 |
-
# Convert audio data to a
|
157 |
-
|
158 |
-
|
159 |
-
#
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
|
|
165 |
|
166 |
st.sidebar.write('Text converted to speech (download available)')
|
167 |
else:
|
|
|
153 |
# Access the audio waveform from the dictionary (assuming key name is 'audio')
|
154 |
audio_data = speech['audio']
|
155 |
|
156 |
+
# Convert audio data to a bytes object
|
157 |
+
wav_bytes = sf.write(None, audio_data, samplerate=speech['sampling_rate'], format='wav')
|
158 |
+
|
159 |
+
# Create a download button for the audio file
|
160 |
+
st.sidebar.download_button(
|
161 |
+
label="Download Audio",
|
162 |
+
data=wav_bytes,
|
163 |
+
file_name="generated_audio.wav",
|
164 |
+
mime="audio/wav"
|
165 |
+
)
|
166 |
|
167 |
st.sidebar.write('Text converted to speech (download available)')
|
168 |
else:
|