Update app.py
Browse files
app.py
CHANGED
@@ -268,17 +268,17 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
268 |
pdf_page_to_image('/home/user/app/pdf2image/output.pdf', page_number, '/home/user/app/pdf2image/output.png')
|
269 |
|
270 |
image = Image.open('/home/user/app/pdf2image/output.png')
|
271 |
-
st.sidebar.image(image)
|
272 |
st.session_state.image_displayed = True
|
273 |
-
|
274 |
|
275 |
def generate_audio():
|
276 |
sound_file = BytesIO()
|
277 |
tts = gTTS(result['result'], lang='en')
|
278 |
tts.write_to_fp(sound_file)
|
279 |
-
st.sidebar.audio(sound_file)
|
280 |
st.session_state.sound_played = True
|
281 |
-
|
282 |
|
283 |
|
284 |
#st.button(':speaker:', type='primary',on_click=generate_audio)
|
@@ -342,14 +342,14 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
342 |
message_placeholder.markdown(full_response + "▌")
|
343 |
message_placeholder.markdown(full_response)
|
344 |
|
345 |
-
if st.
|
346 |
a=generate_pdf()
|
347 |
-
|
348 |
|
349 |
|
350 |
-
if st.
|
351 |
x=generate_audio()
|
352 |
-
|
353 |
|
354 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
355 |
|
|
|
268 |
pdf_page_to_image('/home/user/app/pdf2image/output.pdf', page_number, '/home/user/app/pdf2image/output.png')
|
269 |
|
270 |
image = Image.open('/home/user/app/pdf2image/output.png')
|
271 |
+
#st.sidebar.image(image)
|
272 |
st.session_state.image_displayed = True
|
273 |
+
return image
|
274 |
|
275 |
def generate_audio():
|
276 |
sound_file = BytesIO()
|
277 |
tts = gTTS(result['result'], lang='en')
|
278 |
tts.write_to_fp(sound_file)
|
279 |
+
#st.sidebar.audio(sound_file)
|
280 |
st.session_state.sound_played = True
|
281 |
+
return sound_file
|
282 |
|
283 |
|
284 |
#st.button(':speaker:', type='primary',on_click=generate_audio)
|
|
|
342 |
message_placeholder.markdown(full_response + "▌")
|
343 |
message_placeholder.markdown(full_response)
|
344 |
|
345 |
+
if st.button("Display Image"):
|
346 |
a=generate_pdf()
|
347 |
+
st.sidebar.image(a)
|
348 |
|
349 |
|
350 |
+
if st.button("Play Sound"):
|
351 |
x=generate_audio()
|
352 |
+
st.sidebar.audio(x)
|
353 |
|
354 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
355 |
|