vkumartr commited on
Commit
b415d4c
·
verified ·
1 Parent(s): 040b98e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +90 -25
app.py CHANGED
@@ -108,33 +108,98 @@ Shipping and References:
108
  MBL No./HBL No./Container No./Shipping Bill No./Shipper Invoice No./Manifest No./MAWB/HAWB/OBL No./Bill of Lading Number/REF/Ocean Bill of Lading/House Bill of Lading/BL No./Job No. → Considered as RefNo.
109
  Shipping Order
110
  You should extract this data and structure it into a table-like format in the following JSON format:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  {
112
- "invoice_headers": {
113
- "VendorName": "",
114
- "VendorAddress": "",
115
- "VendorGSTNo": "",
116
- "InvoiceNo": "",
117
- "InvoiceDate": "",
118
- "InvoiceCurrency": "",
119
- "BaseAmount": "",
120
- "TaxAmount": "",
121
- "TotalInvoiceAmt": "",
122
- "TypeofInvoice": "",
123
- "CustomerName": "",
124
- "CustomerAddress": "",
125
- "CustomerGSTNO": "",
126
- "RefNo": "",
127
- "ShippingOrder": ""
128
- },
129
- "line_items": [
130
- {
131
- "Description": "",
132
- "TaxPercentage": "",
133
- "TaxAmount": "",
134
- "Amount": 0
135
- }
136
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  }
 
138
  Guidelines for Processing:
139
 
140
  Ensure accurate extraction of data from the invoice by recognizing alternative naming conventions (e.g., Bill to, Taxpayer Name, etc.).
 
108
  MBL No./HBL No./Container No./Shipping Bill No./Shipper Invoice No./Manifest No./MAWB/HAWB/OBL No./Bill of Lading Number/REF/Ocean Bill of Lading/House Bill of Lading/BL No./Job No. → Considered as RefNo.
109
  Shipping Order
110
  You should extract this data and structure it into a table-like format in the following JSON format:
111
+ # {
112
+ # "invoice_headers": {
113
+ # "VendorName": "",
114
+ # "VendorAddress": "",
115
+ # "VendorGSTNo": "",
116
+ # "InvoiceNo": "",
117
+ # "InvoiceDate": "",
118
+ # "InvoiceCurrency": "",
119
+ # "BaseAmount": "",
120
+ # "TaxAmount": "",
121
+ # "TotalInvoiceAmt": "",
122
+ # "TypeofInvoice": "",
123
+ # "CustomerName": "",
124
+ # "CustomerAddress": "",
125
+ # "CustomerGSTNO": "",
126
+ # "RefNo": "",
127
+ # "ShippingOrder": ""
128
+ # },
129
+ # "line_items": [
130
+ # {
131
+ # "Description": "",
132
+ # "TaxPercentage": "",
133
+ # "TaxAmount": "",
134
+ # "Amount": 0
135
+ # }
136
+ # ]
137
+ # }
138
+
139
  {
140
+ "$schema": "http://json-schema.org/draft-07/schema#",
141
+ "type": "object",
142
+ "title": "Invoice Information Extractor",
143
+ "description": "Schema for extracting specific information from invoices",
144
+ "properties": {
145
+ "invoice_headers": {
146
+ "type": "object",
147
+ "properties": {
148
+ "VendorName": { "type": "string", "description": "The name of the vendor" },
149
+ "VendorAddress": { "type": "string", "description": "The address of the vendor" },
150
+ "VendorGSTNo": { "type": "string", "description": "The GST number of the vendor" },
151
+ "InvoiceNo": { "type": "string", "description": "The number of the invoice" },
152
+ "InvoiceDate": { "type": "string", "format": "date", "description": "The date of the invoice in dd-MMM-yyyy format" },
153
+ "InvoiceCurrency": { "type": "string", "description": "The currency used in the invoice (e.g., USD, INR, AUD)" },
154
+ "BaseAmount": { "type": "number", "description": "The base amount before tax" },
155
+ "TaxAmount": { "type": "number", "description": "The tax amount on the invoice" },
156
+ "TotalInvoiceAmt": { "type": "number", "description": "The total amount on the invoice" },
157
+ "TypeofInvoice": { "type": "string", "description": "Type of invoice (e.g., Tax Invoice, Proforma Invoice)" },
158
+ "CustomerName": { "type": "string", "description": "The name of the customer" },
159
+ "CustomerAddress": { "type": "string", "description": "The address of the customer" },
160
+ "CustomerGSTNO": { "type": "string", "description": "The GST number of the customer" },
161
+ "RefNo": { "type": "string", "description": "Reference number related to shipping or order" },
162
+ "ShippingOrder": { "type": "string", "description": "Shipping order details" }
163
+ },
164
+ "required": [
165
+ "VendorName",
166
+ "VendorAddress",
167
+ "VendorGSTNo",
168
+ "InvoiceNo",
169
+ "InvoiceDate",
170
+ "InvoiceCurrency",
171
+ "BaseAmount",
172
+ "TaxAmount",
173
+ "TotalInvoiceAmt",
174
+ "TypeofInvoice",
175
+ "CustomerName",
176
+ "CustomerAddress",
177
+ "CustomerGSTNO",
178
+ "RefNo",
179
+ "ShippingOrder"
180
+ ],
181
+ "additionalProperties": false
182
+ },
183
+ "line_items": {
184
+ "type": "array",
185
+ "description": "List of line items on the invoice",
186
+ "items": {
187
+ "type": "object",
188
+ "properties": {
189
+ "Description": { "type": "string", "description": "Description of the product/service" },
190
+ "TaxPercentage": { "type": "number", "description": "Tax percentage applied to the line item" },
191
+ "TaxAmount": { "type": "number", "description": "Tax amount for the line item" },
192
+ "Amount": { "type": "number", "description": "The total amount for the line item" }
193
+ },
194
+ "required": ["Description", "TaxPercentage", "TaxAmount", "Amount"],
195
+ "additionalProperties": false
196
+ }
197
+ }
198
+ },
199
+ "required": ["invoice_headers", "line_items"],
200
+ "additionalProperties": false
201
  }
202
+
203
  Guidelines for Processing:
204
 
205
  Ensure accurate extraction of data from the invoice by recognizing alternative naming conventions (e.g., Bill to, Taxpayer Name, etc.).