Spaces:
Sleeping
Sleeping
| 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) |