Spaces:
Runtime error
Runtime error
Jayavathsan
commited on
Commit
•
6910f46
1
Parent(s):
d8a0a3d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from utils import *
|
4 |
+
|
5 |
+
|
6 |
+
def main():
|
7 |
+
load_dotenv()
|
8 |
+
|
9 |
+
st.set_page_config(page_title="Invoice Extraction Bot")
|
10 |
+
st.title("Invoice Extraction Bot...💁 ")
|
11 |
+
st.subheader("I can help you in extracting invoice data")
|
12 |
+
|
13 |
+
|
14 |
+
# Upload the Invoices (pdf files)
|
15 |
+
pdf = st.file_uploader("Upload invoices here, only PDF files allowed", type=["pdf"],accept_multiple_files=True)
|
16 |
+
|
17 |
+
submit=st.button("Extract Data")
|
18 |
+
|
19 |
+
if submit:
|
20 |
+
with st.spinner('Wait for it...'):
|
21 |
+
df=create_docs(pdf)
|
22 |
+
st.write(df.head())
|
23 |
+
|
24 |
+
data_as_csv= df.to_csv(index=False).encode("utf-8")
|
25 |
+
st.download_button(
|
26 |
+
"Download data as CSV",
|
27 |
+
data_as_csv,
|
28 |
+
"benchmark-tools.csv",
|
29 |
+
"text/csv",
|
30 |
+
key="download-tools-csv",
|
31 |
+
)
|
32 |
+
st.success("Hope I was able to save your time❤️")
|
33 |
+
|
34 |
+
|
35 |
+
#Invoking main function
|
36 |
+
if __name__ == '__main__':
|
37 |
+
main()
|