Update app.py
Browse files
app.py
CHANGED
@@ -172,14 +172,12 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
172 |
#st.session_state.reference = True
|
173 |
|
174 |
st.session_state['reference'] = '/home/user/app/pdf2image/default_output.png'
|
175 |
-
st.session_state['audio'] = ''
|
176 |
|
177 |
|
178 |
def generate_audio():
|
179 |
-
sound_file = BytesIO()
|
180 |
tts = gTTS(result['result'], lang='en')
|
181 |
-
tts.
|
182 |
-
return sound_file
|
183 |
|
184 |
for item in output:
|
185 |
full_response += item
|
@@ -201,9 +199,9 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
201 |
st.image(st.session_state['reference'])
|
202 |
|
203 |
if choice == 'TTS':
|
204 |
-
|
205 |
-
st.session_state['audio'] =
|
206 |
-
st.
|
207 |
|
208 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
209 |
|
|
|
172 |
#st.session_state.reference = True
|
173 |
|
174 |
st.session_state['reference'] = '/home/user/app/pdf2image/default_output.png'
|
175 |
+
st.session_state['audio'] = '/home/user/app/audio/audio.mp3'
|
176 |
|
177 |
|
178 |
def generate_audio():
|
|
|
179 |
tts = gTTS(result['result'], lang='en')
|
180 |
+
tts.save('/home/user/app/audio/audio.mp3')
|
|
|
181 |
|
182 |
for item in output:
|
183 |
full_response += item
|
|
|
199 |
st.image(st.session_state['reference'])
|
200 |
|
201 |
if choice == 'TTS':
|
202 |
+
generate_audio()
|
203 |
+
st.session_state['audio'] = '/home/user/app/audio/audio.mp3'
|
204 |
+
st.audio(st.session_state['audio'])
|
205 |
|
206 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
207 |
|