dreji18 commited on
Commit
52e0e7d
·
1 Parent(s): 595d503

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -175,19 +175,26 @@ def app2():
175
  #pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
176
  #st.markdown(pdf_display, unsafe_allow_html=True)
177
 
178
- with open((tempfile.gettempdir()+"/annott.pdf"), "rb") as pdf_file:
179
- PDFbyte = pdf_file.read()
180
-
181
- hy.download_button(label="Download Annotated PDF",
182
- data=PDFbyte,
183
- file_name="annotated.pdf",
184
- mime='application/octet-stream')
185
 
186
 
187
  except Exception as e:
188
  print("Error occured: {}".format(e))
189
  raise e
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
 
192
 
193
  app.run()
 
175
  #pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
176
  #st.markdown(pdf_display, unsafe_allow_html=True)
177
 
178
+
 
 
 
 
 
 
179
 
180
 
181
  except Exception as e:
182
  print("Error occured: {}".format(e))
183
  raise e
184
 
185
+ with open((tempfile.gettempdir()+"/annott.pdf"),"rb") as f:
186
+ base64_pdf = base64.b64encode(f.read()).decode('utf-8')
187
+ pdf_display = f'<embed src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf">'
188
+ pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
189
+ st.markdown(pdf_display, unsafe_allow_html=True)
190
+
191
+ with open((tempfile.gettempdir()+"/annott.pdf"), "rb") as pdf_file:
192
+ PDFbyte = pdf_file.read()
193
+
194
+ hy.download_button(label="Download Annotated PDF",
195
+ data=PDFbyte,
196
+ file_name="annotated.pdf",
197
+ mime='application/octet-stream')
198
 
199
 
200
  app.run()