cam-test / app.py
Amrrs's picture
Upload app.py
f2500ef
import streamlit as st
import subprocess
from subprocess import STDOUT, check_call
import os
@st.cache
def gh():
proc = subprocess.Popen('apt-get install -y ghostscript', shell=True, stdin=None, stdout=open(os.devnull,"wb"), stderr=STDOUT, executable="/bin/bash")
proc.wait()
gh()
import camelot as cam
input_pdf = st.file_uploader(label = "upload your pdf here", type = 'pdf')
import base64
if input_pdf is not None:
with open("input.pdf", "wb") as f:
base64_pdf = base64.b64encode(input_pdf.read()).decode('utf-8')
f.write(base64.b64decode(base64_pdf))
f.close()
#source: https://www.southalabama.edu/mathstat/personal_pages/mulekar/st550/Krishnakumar.pdf
table = cam.read_pdf("input.pdf", flavor = 'stream')
st.write(table)