Spaces:
Running on Zero
Running on Zero
electblake commited on
Commit ·
2903d4c
1
Parent(s): 8ed6de3
Add bank statement samples and extraction presets
Browse files
app/gradio.py
CHANGED
|
@@ -55,6 +55,86 @@ structured_json_templates = {
|
|
| 55 |
"card_last_four": "verbatim-string",
|
| 56 |
"amount_tendered": "number",
|
| 57 |
"change_due": "number"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}""",
|
| 59 |
"Invoice with line items": """{
|
| 60 |
"document_type": "verbatim-string",
|
|
@@ -268,12 +348,21 @@ with gr.Blocks(title="NuExtract3") as demo:
|
|
| 268 |
/ "data"
|
| 269 |
/ "samples"
|
| 270 |
/ "invoice-with-items.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
*sorted(
|
| 272 |
path
|
| 273 |
for path in (Path(__file__).parents[1] / "data" / "samples").glob(
|
| 274 |
"*.png"
|
| 275 |
)
|
| 276 |
-
if path.name
|
|
|
|
| 277 |
),
|
| 278 |
]
|
| 279 |
],
|
|
|
|
| 55 |
"card_last_four": "verbatim-string",
|
| 56 |
"amount_tendered": "number",
|
| 57 |
"change_due": "number"
|
| 58 |
+
}""",
|
| 59 |
+
"Basic bank statement": """{
|
| 60 |
+
"financial_institution": "verbatim-string",
|
| 61 |
+
"account_holder": "verbatim-string",
|
| 62 |
+
"account_number": "verbatim-string",
|
| 63 |
+
"statement_period": {
|
| 64 |
+
"start_date": "date",
|
| 65 |
+
"end_date": "date"
|
| 66 |
+
},
|
| 67 |
+
"opening_balance": "number",
|
| 68 |
+
"closing_balance": "number",
|
| 69 |
+
"currency": "currency",
|
| 70 |
+
"transaction_count": "integer",
|
| 71 |
+
"transactions": [
|
| 72 |
+
{
|
| 73 |
+
"date": "date",
|
| 74 |
+
"description": "verbatim-string",
|
| 75 |
+
"transaction_type": ["debit", "credit", "other"],
|
| 76 |
+
"amount": "number",
|
| 77 |
+
"balance": "number"
|
| 78 |
+
}
|
| 79 |
+
]
|
| 80 |
+
}""",
|
| 81 |
+
"Advanced bank statement": """{
|
| 82 |
+
"financial_institution": {
|
| 83 |
+
"name": "verbatim-string",
|
| 84 |
+
"address": "verbatim-string",
|
| 85 |
+
"phone": "phone-number",
|
| 86 |
+
"website": "url"
|
| 87 |
+
},
|
| 88 |
+
"account_holder": {
|
| 89 |
+
"name": "verbatim-string",
|
| 90 |
+
"address": "verbatim-string"
|
| 91 |
+
},
|
| 92 |
+
"account": {
|
| 93 |
+
"type": "verbatim-string",
|
| 94 |
+
"number": "verbatim-string",
|
| 95 |
+
"branch_number": "verbatim-string",
|
| 96 |
+
"transit_number": "verbatim-string",
|
| 97 |
+
"routing_number": "verbatim-string",
|
| 98 |
+
"iban": "iban",
|
| 99 |
+
"bic": "bic"
|
| 100 |
+
},
|
| 101 |
+
"statement_period": {
|
| 102 |
+
"start_date": "date",
|
| 103 |
+
"end_date": "date"
|
| 104 |
+
},
|
| 105 |
+
"summary": {
|
| 106 |
+
"opening_balance": "number",
|
| 107 |
+
"total_credits": "number",
|
| 108 |
+
"total_debits": "number",
|
| 109 |
+
"total_fees": "number",
|
| 110 |
+
"total_interest": "number",
|
| 111 |
+
"closing_balance": "number",
|
| 112 |
+
"currency": "currency"
|
| 113 |
+
},
|
| 114 |
+
"transaction_count": "integer",
|
| 115 |
+
"transactions": [
|
| 116 |
+
{
|
| 117 |
+
"transaction_date": "date",
|
| 118 |
+
"posting_date": "date",
|
| 119 |
+
"description": "verbatim-string",
|
| 120 |
+
"reference_number": "verbatim-string",
|
| 121 |
+
"category": [
|
| 122 |
+
"deposit",
|
| 123 |
+
"withdrawal",
|
| 124 |
+
"transfer",
|
| 125 |
+
"payment",
|
| 126 |
+
"purchase",
|
| 127 |
+
"fee",
|
| 128 |
+
"interest",
|
| 129 |
+
"refund",
|
| 130 |
+
"other"
|
| 131 |
+
],
|
| 132 |
+
"debit": "number",
|
| 133 |
+
"credit": "number",
|
| 134 |
+
"balance": "number",
|
| 135 |
+
"currency": "currency"
|
| 136 |
+
}
|
| 137 |
+
]
|
| 138 |
}""",
|
| 139 |
"Invoice with line items": """{
|
| 140 |
"document_type": "verbatim-string",
|
|
|
|
| 348 |
/ "data"
|
| 349 |
/ "samples"
|
| 350 |
/ "invoice-with-items.png",
|
| 351 |
+
Path(__file__).parents[1]
|
| 352 |
+
/ "data"
|
| 353 |
+
/ "samples"
|
| 354 |
+
/ "BankStatementChequing.png",
|
| 355 |
+
Path(__file__).parents[1]
|
| 356 |
+
/ "data"
|
| 357 |
+
/ "samples"
|
| 358 |
+
/ "bank statement blog image.webp",
|
| 359 |
*sorted(
|
| 360 |
path
|
| 361 |
for path in (Path(__file__).parents[1] / "data" / "samples").glob(
|
| 362 |
"*.png"
|
| 363 |
)
|
| 364 |
+
if path.name
|
| 365 |
+
not in {"BankStatementChequing.png", "invoice-with-items.png"}
|
| 366 |
),
|
| 367 |
]
|
| 368 |
],
|
data/samples/BankStatementChequing.png
ADDED
|
Git LFS Details
|
data/samples/bank statement blog image.webp
ADDED
|
Git LFS Details
|