Balaprime commited on
Commit
b4f1e0d
·
verified ·
1 Parent(s): 2e84d47

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from utils import create_docs
4
+
5
+ def process_invoices(file_list):
6
+ if not file_list:
7
+ return "No files uploaded", None
8
+
9
+ df = create_docs(file_list)
10
+ if df.empty:
11
+ return "No data extracted from the PDFs.", None
12
+ else:
13
+ return "Data extraction completed! 🎉", df
14
+
15
+ demo = gr.Interface(
16
+ fn=process_invoices,
17
+ inputs=gr.File(file_types=[".pdf"], file_count="multiple", label="Upload PDF invoices"),
18
+ outputs=[
19
+ gr.Textbox(label="Status"),
20
+ gr.Dataframe(label="Extracted Invoice Data")
21
+ ],
22
+ title="Invoice Extraction Bot 🤖",
23
+ description="Upload your PDF invoices to extract key information like invoice number, date, items, totals, and contact info.",
24
+ allow_flagging="never"
25
+ )
26
+
27
+ if __name__ == "__main__":
28
+ demo.launch()