mishrasahil934 commited on
Commit
ec9702c
·
verified ·
1 Parent(s): c0b040c
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -55,17 +55,17 @@ def llm_pipleline1(ans):
55
  return result
56
 
57
  @st.cache_data
58
- #function to display the pdf file
59
  def displayPDF(file):
60
- #opening file from file path
61
  with open(file, "rb") as f:
62
- base_pdf = base64.bb64encode(f.read()).decode('utf-8')
63
 
64
- #embedding pdf in html
65
- pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
66
-
67
- #displaying file
68
- st.markdown(pdf_display, unsafe_allow_html=True)
69
 
70
  #streamlit code
71
  st.set_page_config(layout='wide')
@@ -79,7 +79,7 @@ def main():
79
  if uploaded_file is not None:
80
  if st.button("summarize"):
81
  col1,col2 = st.columns(2)
82
- filepath = "home/user/app"+uploaded_file.name
83
  with open(filepath, 'wb') as temp_file:
84
  temp_file.write(uploaded_file.read())
85
  with col1:
 
55
  return result
56
 
57
  @st.cache_data
58
+ # Function to display the PDF file
59
  def displayPDF(file):
60
+ # Opening file from file path
61
  with open(file, "rb") as f:
62
+ base_pdf = base64.b64encode(f.read()).decode('utf-8') # Corrected function name and variable
63
 
64
+ # Embedding PDF in HTML
65
+ pdf_display = f'<iframe src="data:application/pdf;base64,{base_pdf}" width="100%" height="600" type="application/pdf"></iframe>'
66
+
67
+ # Displaying the file
68
+ st.markdown(pdf_display, unsafe_allow_html=True)
69
 
70
  #streamlit code
71
  st.set_page_config(layout='wide')
 
79
  if uploaded_file is not None:
80
  if st.button("summarize"):
81
  col1,col2 = st.columns(2)
82
+ filepath = "data/"+uploaded_file.name
83
  with open(filepath, 'wb') as temp_file:
84
  temp_file.write(uploaded_file.read())
85
  with col1: