mp-02's picture
Update app.py
136671b verified
from inference import prediction
import gradio as gr
import json
title = "Interactive demo: LayoutLMv3 for receipts"
description = "Demo for Microsoft's LayoutLMv3, a Transformer for state-of-the-art document image understanding tasks. This particular space uses an instance of the model fine-tuned on a dataset that combines CORD and SROIE.\n To use it, simply upload an image or use the example image below. Results will show up in a few seconds."
examples = [['image.jpg'],['image.PNG']]
css = """.output_image, .input_image {height: 600px !important}, .output_json { color: black; }"""
# gradio interface that takes in input an image and return a JSON file that contains its info
# for now it shows also the intermediate steps
iface = gr.Interface(theme=gr.themes.Monochrome(),
fn=prediction,
inputs=gr.Image(type="pil"),
outputs=[
#gr.Image(type="pil", label="annotated image"),
gr.JSON(label="final output")],
title=title,
description=description,
examples=examples,
css=css)
iface.launch()