Spaces:
Running
Running
Frontend Application File
Browse files
app.py
CHANGED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# from backend import ResultPipeline
|
2 |
+
import streamlit as st
|
3 |
+
from backend import InvoicePipeline
|
4 |
+
def main():
|
5 |
+
# Just for setting up the title & head bar
|
6 |
+
st.set_page_config(page_title = "Bill App")
|
7 |
+
st.title("Bill Extractor")
|
8 |
+
|
9 |
+
# This section will handle uploadation of files
|
10 |
+
files = st.file_uploader("Upload the files here..", type = ["pdf"], accept_multiple_files = True)
|
11 |
+
submit = st.button("Extract")
|
12 |
+
|
13 |
+
# If a user has submitted the fieles, we need to call our pipeline
|
14 |
+
if submit:
|
15 |
+
with st.spinner("Please wait, while we are processing your information..."):
|
16 |
+
pipe = InvoicePipeline(files)
|
17 |
+
df_results = pipe.run()
|
18 |
+
st.write(df_results)
|
19 |
+
|
20 |
+
|
21 |
+
convert_to_csv = df_results.to_csv(index = False).encode("utf-8")
|
22 |
+
st.download_button(
|
23 |
+
"Download",
|
24 |
+
convert_to_csv,
|
25 |
+
"bills.csv",
|
26 |
+
"text/csv",
|
27 |
+
key = "download-csv"
|
28 |
+
)
|
29 |
+
|
30 |
+
|
31 |
+
# Calling the main function
|
32 |
+
if __name__ == "__main__":
|
33 |
+
main()
|