hafsamalik322 commited on
Commit
437c6d1
·
verified ·
1 Parent(s): 4d150b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -21,13 +21,13 @@ def llm_pipeline(filepath, max_length, min_length):
21
 
22
  return summary
23
 
24
- # def displayPDF(file):
25
- # # Opening file from file path
26
- # with open(file, "rb") as f:
27
- # base64_pdf = base64.b64encode(f.read()).decode('utf-8')
28
 
29
- # pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
30
- # st.markdown(pdf_display, unsafe_allow_html=True)
31
 
32
  if __name__ == "__main__":
33
  st.set_page_config(layout="wide")
@@ -42,6 +42,8 @@ if __name__ == "__main__":
42
  if st.button("Summarize"):
43
  col1, col2 = st.columns(2)
44
  filepath = uploaded_file.name
 
 
45
  # with col1:
46
  # st.info("Uploaded File")
47
  # pdf_view = displayPDF(filepath)
 
21
 
22
  return summary
23
 
24
+ def displayPDF(file):
25
+ # Opening file from file path
26
+ with open(file, "rb") as f:
27
+ base64_pdf = base64.b64encode(f.read()).decode('utf-8')
28
 
29
+ pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
30
+ st.markdown(pdf_display, unsafe_allow_html=True)
31
 
32
  if __name__ == "__main__":
33
  st.set_page_config(layout="wide")
 
42
  if st.button("Summarize"):
43
  col1, col2 = st.columns(2)
44
  filepath = uploaded_file.name
45
+ with open(filepath, "wb") as temp_file:
46
+ temp_file.write(uploaded_file.read())
47
  # with col1:
48
  # st.info("Uploaded File")
49
  # pdf_view = displayPDF(filepath)