root
commited on
Commit
·
09cbe60
1
Parent(s):
a7d9e19
update
Browse files
app.py
CHANGED
|
@@ -338,8 +338,8 @@ with gr.Blocks(head=GOOGLE_FONTS_URL, css=custom_css, theme=gr.themes.Soft()) as
|
|
| 338 |
gr.HTML("""
|
| 339 |
<div class="quick-links">
|
| 340 |
<a href="https://github.com/PaddlePaddle/PaddleOCR" target="_blank">GitHub</a> |
|
| 341 |
-
<a href="https://
|
| 342 |
-
<a href="https://
|
| 343 |
</div>
|
| 344 |
""")
|
| 345 |
|
|
@@ -351,7 +351,7 @@ with gr.Blocks(head=GOOGLE_FONTS_URL, css=custom_css, theme=gr.themes.Soft()) as
|
|
| 351 |
preview_doc_html = gr.HTML(value="", elem_id="image_preview_doc", visible=False)
|
| 352 |
|
| 353 |
gr.Markdown("_( Use this mode for recognizing full-page documents with structured layouts, such as reports, papers, or magazines.)_")
|
| 354 |
-
gr.Markdown("💡 *To recognize a single, pre-cropped element (e.g., a table or formula), switch to the '
|
| 355 |
|
| 356 |
with gr.Row(variant="panel"):
|
| 357 |
chart_parsing_switch = gr.Checkbox(label="Enable chart parsing", value=False, scale=1)
|
|
@@ -376,7 +376,7 @@ with gr.Blocks(head=GOOGLE_FONTS_URL, css=custom_css, theme=gr.themes.Soft()) as
|
|
| 376 |
file_doc.change(fn=update_preview_visibility, inputs=[file_doc], outputs=[preview_doc_html])
|
| 377 |
btn_parse.click(fn=handle_complex_doc, inputs=[file_doc, chart_parsing_switch], outputs=[md_preview_doc, vis_image_doc, md_raw_doc])
|
| 378 |
|
| 379 |
-
with gr.Tab("
|
| 380 |
with gr.Row():
|
| 381 |
with gr.Column(scale=5):
|
| 382 |
file_vl = gr.File(label="Upload Image", file_count="single", type="filepath", file_types=["image"])
|
|
@@ -394,7 +394,7 @@ with gr.Blocks(head=GOOGLE_FONTS_URL, css=custom_css, theme=gr.themes.Soft()) as
|
|
| 394 |
if targeted_recognition_examples:
|
| 395 |
targeted_paths = [e[0] for e in targeted_recognition_examples]
|
| 396 |
targeted_state = gr.State(targeted_paths)
|
| 397 |
-
gr.Markdown("**
|
| 398 |
gallery_targeted = gr.Gallery(value=targeted_paths, columns=4, height=400, preview=False, label=None, allow_preview=False)
|
| 399 |
gallery_targeted.select(fn=_on_gallery_select, inputs=[targeted_state], outputs=[file_vl])
|
| 400 |
|
|
|
|
| 338 |
gr.HTML("""
|
| 339 |
<div class="quick-links">
|
| 340 |
<a href="https://github.com/PaddlePaddle/PaddleOCR" target="_blank">GitHub</a> |
|
| 341 |
+
<a href="https://huggingface.co/spaces/PaddlePaddle/PaddleOCR-VL_Online_Demo" target="_blank">Technical Report</a> |
|
| 342 |
+
<a href="https://huggingface.co/spaces/PaddlePaddle/PaddleOCR-VL_Online_Demo" target="_blank">Model</a>
|
| 343 |
</div>
|
| 344 |
""")
|
| 345 |
|
|
|
|
| 351 |
preview_doc_html = gr.HTML(value="", elem_id="image_preview_doc", visible=False)
|
| 352 |
|
| 353 |
gr.Markdown("_( Use this mode for recognizing full-page documents with structured layouts, such as reports, papers, or magazines.)_")
|
| 354 |
+
gr.Markdown("💡 *To recognize a single, pre-cropped element (e.g., a table or formula), switch to the 'Element-level Recognition' tab for better results.*")
|
| 355 |
|
| 356 |
with gr.Row(variant="panel"):
|
| 357 |
chart_parsing_switch = gr.Checkbox(label="Enable chart parsing", value=False, scale=1)
|
|
|
|
| 376 |
file_doc.change(fn=update_preview_visibility, inputs=[file_doc], outputs=[preview_doc_html])
|
| 377 |
btn_parse.click(fn=handle_complex_doc, inputs=[file_doc, chart_parsing_switch], outputs=[md_preview_doc, vis_image_doc, md_raw_doc])
|
| 378 |
|
| 379 |
+
with gr.Tab("Element-level Recognition"):
|
| 380 |
with gr.Row():
|
| 381 |
with gr.Column(scale=5):
|
| 382 |
file_vl = gr.File(label="Upload Image", file_count="single", type="filepath", file_types=["image"])
|
|
|
|
| 394 |
if targeted_recognition_examples:
|
| 395 |
targeted_paths = [e[0] for e in targeted_recognition_examples]
|
| 396 |
targeted_state = gr.State(targeted_paths)
|
| 397 |
+
gr.Markdown("**Element-level Recognition Examples (Click an image to load)**")
|
| 398 |
gallery_targeted = gr.Gallery(value=targeted_paths, columns=4, height=400, preview=False, label=None, allow_preview=False)
|
| 399 |
gallery_targeted.select(fn=_on_gallery_select, inputs=[targeted_state], outputs=[file_vl])
|
| 400 |
|