Spaces:
Runtime error
Runtime error
Added additional inline display of my dissertation on the dissertation page
Browse files
pages/003_Dissertation.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
|
3 |
from src.st_helpers import st_setup
|
4 |
|
@@ -8,9 +9,16 @@ if st_setup('Dissertation'):
|
|
8 |
|
9 |
st.write("*NOTE - ONLY TEMP FILES RIGHT NOW - THESE WILL BE ADDED WHEN COMPLETE*")
|
10 |
|
|
|
11 |
with open("img/dissertation.pdf", "rb") as f:
|
12 |
pdf_bytes = f.read()
|
13 |
st.download_button(label="Download dissertation",
|
14 |
data=pdf_bytes,
|
15 |
file_name="dissertation.pdf",
|
16 |
mime='application/octet-stream')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import base64
|
3 |
|
4 |
from src.st_helpers import st_setup
|
5 |
|
|
|
9 |
|
10 |
st.write("*NOTE - ONLY TEMP FILES RIGHT NOW - THESE WILL BE ADDED WHEN COMPLETE*")
|
11 |
|
12 |
+
# Provide a button to download the document
|
13 |
with open("img/dissertation.pdf", "rb") as f:
|
14 |
pdf_bytes = f.read()
|
15 |
st.download_button(label="Download dissertation",
|
16 |
data=pdf_bytes,
|
17 |
file_name="dissertation.pdf",
|
18 |
mime='application/octet-stream')
|
19 |
+
|
20 |
+
# Also show the document inline
|
21 |
+
with open("img/dissertation.pdf", "rb") as f:
|
22 |
+
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
23 |
+
pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="1000" height="1500" type="application/pdf"></iframe>'
|
24 |
+
st.markdown(pdf_display, unsafe_allow_html=True)
|