Spaces:
Sleeping
Sleeping
hafizh zaki prasetyo adi
commited on
Commit
•
b1fcfaa
1
Parent(s):
8bf9e46
initial commit
Browse files- app.py +22 -0
- requirements.txt +17 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from tablecv import extract_table
|
3 |
+
|
4 |
+
img_name = st.file_uploader("Upload an image with table(s)")
|
5 |
+
if img_name is not None:
|
6 |
+
st.image(img_name)
|
7 |
+
extracted_tables = extract_table(image_path=img_name)
|
8 |
+
|
9 |
+
@st.experimental_memo
|
10 |
+
def convert_df(df):
|
11 |
+
return df.to_csv(index=False).encode('utf-8')
|
12 |
+
|
13 |
+
|
14 |
+
csv = convert_df(extracted_tables)
|
15 |
+
st.table(extracted_tables)
|
16 |
+
st.download_button(
|
17 |
+
"Press to Download",
|
18 |
+
csv,
|
19 |
+
"file.csv",
|
20 |
+
"text/csv",
|
21 |
+
key='download-csv'
|
22 |
+
)
|
requirements.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
beautifulsoup4==4.12.3
|
2 |
+
camelot_py==0.11.0
|
3 |
+
fastapi==0.110.0
|
4 |
+
fuzzywuzzy==0.18.0
|
5 |
+
img2table==1.2.11
|
6 |
+
numpy==1.26.4
|
7 |
+
opencv_contrib_python==4.5.4.60
|
8 |
+
opencv_python==4.5.4.60
|
9 |
+
opencv_python_headless==4.5.4.60
|
10 |
+
pandas==2.2.1
|
11 |
+
PyMuPDF==1.20.2
|
12 |
+
python_doctr==0.8.0
|
13 |
+
Requests==2.31.0
|
14 |
+
streamlit==1.31.1
|
15 |
+
tablecv==0.1.1
|
16 |
+
ultralytics==8.1.20
|
17 |
+
uvicorn==0.29.0
|