Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,8 @@ from functionforDownloadButtons import download_button
|
|
| 15 |
import fitz
|
| 16 |
import pandas as pd
|
| 17 |
import base64
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# set page size wide and theme
|
| 20 |
st.set_page_config(layout='wide', initial_sidebar_state='collapsed',)
|
|
@@ -162,14 +164,12 @@ def app2():
|
|
| 162 |
else:
|
| 163 |
print("No Entities Extracted!!!")
|
| 164 |
|
| 165 |
-
|
| 166 |
-
document.save(
|
| 167 |
-
|
| 168 |
-
#final_df.to_csv(uploaded_file.replace(".pdf", "_df.csv"))
|
| 169 |
-
#return final_df
|
| 170 |
|
| 171 |
with c2:
|
| 172 |
-
with open(
|
| 173 |
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
| 174 |
pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
|
| 175 |
st.markdown(pdf_display, unsafe_allow_html=True)
|
|
|
|
| 15 |
import fitz
|
| 16 |
import pandas as pd
|
| 17 |
import base64
|
| 18 |
+
import tempfile
|
| 19 |
+
import os
|
| 20 |
|
| 21 |
# set page size wide and theme
|
| 22 |
st.set_page_config(layout='wide', initial_sidebar_state='collapsed',)
|
|
|
|
| 164 |
else:
|
| 165 |
print("No Entities Extracted!!!")
|
| 166 |
|
| 167 |
+
temp_dir = tempfile.TemporaryDirectory()
|
| 168 |
+
document.save(tempfile.gettempdir()+"\\annott.pdf")
|
| 169 |
+
|
|
|
|
|
|
|
| 170 |
|
| 171 |
with c2:
|
| 172 |
+
with open((tempfile.gettempdir()+"\\annott.pdf"),"rb") as f:
|
| 173 |
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
| 174 |
pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
|
| 175 |
st.markdown(pdf_display, unsafe_allow_html=True)
|