How to preview a uploaded file in streamlit

Hi folks, I found a way to preview a uploaded pdf file in a simpler and browser like style

Just use :

import streamlit as st
uploaded_file = st.file_uploader("Choose a PDF file", type="pdf")
if uploaded_file is not None:
    import base64
    pdf__bytes = uploaded_file.getvalue()
    base64_pdf = base64.b64encode(pdf__bytes).decode('utf-8')
    pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="100%" height="600" type="application/pdf"> style="border: none;"</iframe>'
    st.markdown(pdf_display, unsafe_allow_html=True)

and this viewer looks a lot better then streamlit library for pdf viewer.