vishwask commited on
Commit
06451c6
·
1 Parent(s): 22b32fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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
- #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,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.sidebar.button("Display Image"):
346
  a=generate_pdf()
347
- message_placeholder.image(a)
348
 
349
 
350
- if st.sidebar.button("Play Sound"):
351
  x=generate_audio()
352
- message_placeholder.audio(x)
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