Rendering PDF on UI

Currently, on my local, I’m able to successfully render PDF files onto my UI. However, as I’m trying to deploy the app I’m running into the PDF file not being shown on the UI.

As you can see through the inspect tools, the file’s component is being generated.

Local:

Deployed:

Code:

def displayPDF(file):
    # Opening file from file path
    with open(file, "rb") as f:
        base64_pdf = base64.b64encode(f.read()).decode('utf-8')

    # Embedding PDF in HTML
    pdf_display = F'<embed src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf">'

    # Displaying File
    st.markdown(pdf_display, unsafe_allow_html=True)

Using iframe instead of embed worked like a charm.

pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf"></iframe>'