Spaces:
Running
Running
Create app.py (#3)
Browse files- Create app.py (546f5ed522a40e1ade2279ffc0c23375c65ca26c)
app.py
CHANGED
@@ -55,17 +55,17 @@ def llm_pipleline1(ans):
|
|
55 |
return result
|
56 |
|
57 |
@st.cache_data
|
58 |
-
#
|
59 |
def displayPDF(file):
|
60 |
-
#
|
61 |
with open(file, "rb") as f:
|
62 |
-
base_pdf = base64.
|
63 |
|
64 |
-
#
|
65 |
-
pdf_display =
|
66 |
-
|
67 |
-
#
|
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 = "
|
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:
|