Spaces:
Sleeping
Sleeping
File size: 603 Bytes
e8e33af b6dc727 e8e33af b6dc727 e8e33af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import gradio as gr
from ..processing.parse_img import parse_img
def ui_predict_fn(image):
# Wrapper to format data specifically for Gradio Gallery
_, gallery_items = parse_img(image)
return gallery_items
# Define the Interface/Blocks
with gr.Blocks(title="DocLayout Parser") as gradio_app:
gr.Markdown("## Irandoc OCR")
with gr.Row():
input_img = gr.Image(type="pil", label="Upload Document")
output_gal = gr.Gallery(label="Parsed Regions")
btn = gr.Button("Parse", variant="primary")
btn.click(fn=ui_predict_fn, inputs=input_img, outputs=output_gal) |