Spaces:
Sleeping
Sleeping
File size: 1,207 Bytes
6353a8a 3fda4ee f6fdbdf 679eed2 3fda4ee 136671b 3fda4ee fc77b97 9cf6c7d 3fda4ee 52f36f3 8683ec6 3fda4ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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()
|