Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -579,25 +579,39 @@ State-of-the-art OCR on OlmOCR-Bench, ~9× smaller and faster than competitors.
|
|
| 579 |
],
|
| 580 |
)
|
| 581 |
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 599 |
)
|
| 600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 601 |
|
| 602 |
with gr.Row():
|
| 603 |
with gr.Column():
|
|
|
|
| 579 |
],
|
| 580 |
)
|
| 581 |
|
| 582 |
+
# Example inputs with image previews
|
| 583 |
+
EXAMPLE_IMAGES = [
|
| 584 |
+
"examples/example_1.png",
|
| 585 |
+
"examples/example_2.png",
|
| 586 |
+
"examples/example_3.png",
|
| 587 |
+
"examples/example_4.png",
|
| 588 |
+
"examples/example_5.png",
|
| 589 |
+
"examples/example_6.png",
|
| 590 |
+
"examples/example_7.png",
|
| 591 |
+
"examples/example_8.png",
|
| 592 |
+
"examples/example_9.png",
|
| 593 |
+
]
|
| 594 |
+
|
| 595 |
+
with gr.Accordion("📁 Example Documents (click an image to load)", open=True):
|
| 596 |
+
example_gallery = gr.Gallery(
|
| 597 |
+
value=EXAMPLE_IMAGES,
|
| 598 |
+
columns=5,
|
| 599 |
+
rows=2,
|
| 600 |
+
height="auto",
|
| 601 |
+
object_fit="contain",
|
| 602 |
+
show_label=False,
|
| 603 |
+
allow_preview=False,
|
| 604 |
)
|
| 605 |
|
| 606 |
+
def load_example_image(evt: gr.SelectData):
|
| 607 |
+
"""Load selected example image into file input."""
|
| 608 |
+
return EXAMPLE_IMAGES[evt.index]
|
| 609 |
+
|
| 610 |
+
example_gallery.select(
|
| 611 |
+
fn=load_example_image,
|
| 612 |
+
outputs=[file_input],
|
| 613 |
+
)
|
| 614 |
+
|
| 615 |
|
| 616 |
with gr.Row():
|
| 617 |
with gr.Column():
|