Amrrs commited on
Commit
f2500ef
1 Parent(s): e1b609c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import subprocess
3
+ from subprocess import STDOUT, check_call
4
+ import os
5
+
6
+
7
+ @st.cache
8
+ def gh():
9
+ proc = subprocess.Popen('apt-get install -y ghostscript', shell=True, stdin=None, stdout=open(os.devnull,"wb"), stderr=STDOUT, executable="/bin/bash")
10
+ proc.wait()
11
+
12
+ gh()
13
+
14
+
15
+
16
+ import camelot as cam
17
+
18
+ input_pdf = st.file_uploader(label = "upload your pdf here", type = 'pdf')
19
+
20
+
21
+ import base64
22
+ if input_pdf is not None:
23
+ with open("input.pdf", "wb") as f:
24
+ base64_pdf = base64.b64encode(input_pdf.read()).decode('utf-8')
25
+ f.write(base64.b64decode(base64_pdf))
26
+ f.close()
27
+
28
+ #source: https://www.southalabama.edu/mathstat/personal_pages/mulekar/st550/Krishnakumar.pdf
29
+ table = cam.read_pdf("input.pdf", flavor = 'stream')
30
+ st.write(table)