Spaces:
Running on Zero
Running on Zero
electblake commited on
Commit ·
4cf1457
1
Parent(s): 77d3eb3
Show named presets in Gradio examples
Browse files- app/gradio.py +57 -25
app/gradio.py
CHANGED
|
@@ -334,40 +334,72 @@ with gr.Blocks(title="NuMarkApp") as demo:
|
|
| 334 |
gr.Examples(
|
| 335 |
examples=[
|
| 336 |
[
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
"",
|
| 339 |
-
"
|
| 340 |
-
structured_json_templates[default_structured_json_template],
|
| 341 |
False,
|
| 342 |
-
]
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
Path(__file__).parents[1]
|
| 353 |
-
/ "data"
|
| 354 |
-
/ "samples"
|
| 355 |
-
/ "BankStatementChequing.png",
|
| 356 |
-
Path(__file__).parents[1]
|
| 357 |
-
/ "data"
|
| 358 |
-
/ "samples"
|
| 359 |
-
/ "bank statement blog image.webp",
|
| 360 |
-
*sorted(
|
| 361 |
path
|
| 362 |
for path in (Path(__file__).parents[1] / "data" / "samples").glob(
|
| 363 |
"*.png"
|
| 364 |
)
|
| 365 |
if path.name
|
| 366 |
not in {"BankStatementChequing.png", "invoice-with-items.png"}
|
| 367 |
-
)
|
| 368 |
-
]
|
| 369 |
],
|
| 370 |
-
inputs=[image, text, mode,
|
| 371 |
)
|
| 372 |
|
| 373 |
template_preset.change(
|
|
|
|
| 334 |
gr.Examples(
|
| 335 |
examples=[
|
| 336 |
[
|
| 337 |
+
"Basic receipt",
|
| 338 |
+
str(
|
| 339 |
+
Path(__file__).parents[1]
|
| 340 |
+
/ "data"
|
| 341 |
+
/ "samples"
|
| 342 |
+
/ "receipt-ocr-original.webp"
|
| 343 |
+
),
|
| 344 |
+
"",
|
| 345 |
+
"structured",
|
| 346 |
+
False,
|
| 347 |
+
],
|
| 348 |
+
[
|
| 349 |
+
"Invoice with line items",
|
| 350 |
+
str(
|
| 351 |
+
Path(__file__).parents[1]
|
| 352 |
+
/ "data"
|
| 353 |
+
/ "samples"
|
| 354 |
+
/ "invoice-with-items.png"
|
| 355 |
+
),
|
| 356 |
+
"",
|
| 357 |
+
"structured",
|
| 358 |
+
False,
|
| 359 |
+
],
|
| 360 |
+
[
|
| 361 |
+
"Advanced bank statement",
|
| 362 |
+
str(
|
| 363 |
+
Path(__file__).parents[1]
|
| 364 |
+
/ "data"
|
| 365 |
+
/ "samples"
|
| 366 |
+
/ "BankStatementChequing.png"
|
| 367 |
+
),
|
| 368 |
+
"",
|
| 369 |
+
"structured",
|
| 370 |
+
False,
|
| 371 |
+
],
|
| 372 |
+
[
|
| 373 |
+
"Basic bank statement",
|
| 374 |
+
str(
|
| 375 |
+
Path(__file__).parents[1]
|
| 376 |
+
/ "data"
|
| 377 |
+
/ "samples"
|
| 378 |
+
/ "bank statement blog image.webp"
|
| 379 |
+
),
|
| 380 |
"",
|
| 381 |
+
"structured",
|
|
|
|
| 382 |
False,
|
| 383 |
+
],
|
| 384 |
+
*[
|
| 385 |
+
[
|
| 386 |
+
default_structured_json_template,
|
| 387 |
+
str(path),
|
| 388 |
+
"",
|
| 389 |
+
"content",
|
| 390 |
+
False,
|
| 391 |
+
]
|
| 392 |
+
for path in sorted(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
path
|
| 394 |
for path in (Path(__file__).parents[1] / "data" / "samples").glob(
|
| 395 |
"*.png"
|
| 396 |
)
|
| 397 |
if path.name
|
| 398 |
not in {"BankStatementChequing.png", "invoice-with-items.png"}
|
| 399 |
+
)
|
| 400 |
+
],
|
| 401 |
],
|
| 402 |
+
inputs=[template_preset, image, text, mode, enable_thinking],
|
| 403 |
)
|
| 404 |
|
| 405 |
template_preset.change(
|