|
import streamlit as st |
|
from PyPDF2 import PdfReader |
|
import base64 |
|
|
|
|
|
def display_pdf(pdf_path): |
|
|
|
with open(pdf_path, "rb") as pdf_file: |
|
pdf_bytes = pdf_file.read() |
|
pdf_base64 = base64.b64encode(pdf_bytes).decode('utf-8') |
|
|
|
|
|
pdf_display = f'<embed src="data:application/pdf;base64,{pdf_base64}" width="700" height="900" type="application/pdf">' |
|
st.markdown(pdf_display, unsafe_allow_html=True) |
|
|
|
|
|
st.title("Diagnostic Pathology Test Results - PDF Report") |
|
|
|
|
|
pdf_file = st.file_uploader("Upload PDF Report", type="pdf") |
|
|
|
|
|
if pdf_file is not None: |
|
st.write("### Displaying Uploaded Report") |
|
display_pdf(pdf_file) |
|
|
|
else: |
|
|
|
st.write("### Displaying Static PDF Report") |
|
display_pdf("path_to_your_pdf_report.pdf") |
|
|