Spaces:
Runtime error
Runtime error
import streamlit as st | |
import base64 | |
from src.st_helpers import st_setup | |
if st_setup('Dissertation'): | |
st.write("# Dissertation") | |
st.write("The dissertation is delivered as a PDF dcoument. In addition, the submission is supported by a short video giving an overview of the project for orientation.") | |
st.write("*NOTE - ONLY TEMP FILES RIGHT NOW - THESE WILL BE ADDED WHEN COMPLETE*") | |
# Provide a button to download the document | |
with open("img/dissertation.pdf", "rb") as f: | |
pdf_bytes = f.read() | |
st.download_button(label="Download dissertation", | |
data=pdf_bytes, | |
file_name="dissertation.pdf", | |
mime='application/octet-stream') | |
# Also show the document inline | |
with open("img/dissertation.pdf", "rb") as f: | |
base64_pdf = base64.b64encode(f.read()).decode('utf-8') | |
pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="1000" height="1500" type="application/pdf"></iframe>' | |
st.markdown(pdf_display, unsafe_allow_html=True) | |