wiwaaw commited on
Commit
25fc809
1 Parent(s): c3df5be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -46,8 +46,8 @@ def language_model_pipeline(filepath):
46
  def display_pdf(file):
47
  with open(file, "rb") as f:
48
  base64_pdf = base64.b64encode(f.read()).decode('utf-8')
49
-
50
- pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
51
  st.markdown(pdf_display, unsafe_allow_html=True)
52
 
53
  # Streamlit code
@@ -69,7 +69,13 @@ def main():
69
  pdf_view = display_pdf(filepath)
70
 
71
  with col2:
72
- summarized_result = language_model_pipeline(filepath)
 
 
 
 
 
 
73
  st.info("Summarization Complete")
74
  st.success(summarized_result)
75
 
 
46
  def display_pdf(file):
47
  with open(file, "rb") as f:
48
  base64_pdf = base64.b64encode(f.read()).decode('utf-8')
49
+
50
+ pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf">'
51
  st.markdown(pdf_display, unsafe_allow_html=True)
52
 
53
  # Streamlit code
 
69
  pdf_view = display_pdf(filepath)
70
 
71
  with col2:
72
+ result_holder = st.empty()
73
+ def progress(p, i, decoded):
74
+ with result_holder.container():
75
+ st.progress(p, f'Progress{i}')
76
+ if decoded and decoded[0]:
77
+ st.markdown(decoded[0])
78
+ summarized_result = language_model_pipeline(filepath, callback=progress)
79
  st.info("Summarization Complete")
80
  st.success(summarized_result)
81