Team Ai
Apppublic

beihai/PDF-Table-Extractor

sourceHugging Facebsd-3-clause-clearupdated 4y agoView on Hugging Face
2likes
functions.py16 linesDownload Raw Back to root
1import streamlit as st2import base643 4def build_pdf(file_uploader):5    # byte object into a PDF file 6    with open("input.pdf", "wb") as f:7        base64_pdf = base64.b64encode(file_uploader.read()).decode('utf-8')8        f.write(base64.b64decode(base64_pdf))9    f.close()10 11def show_pdf(file_path):12    with open(file_path,"rb") as f:13        base64_pdf = base64.b64encode(f.read()).decode('utf-8')14    pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'15    st.markdown(pdf_display, unsafe_allow_html=True)   16