Sarath2002/Form_Understanding_using_LayoutLMV3
1
1import gradio as gr2from PIL import Image3from support import processor4import os5 6os.system("pip install -r requirements.txt")7 8 9def OCR_processor(input_image):10 ##input_image = Image.open(input_image)11 return processor(input_image)12 13examples =[['eg1.png'],['eg2.png'],['eg3.png']]14iface = gr.Interface(15 fn=OCR_processor,16 inputs=gr.inputs.Image(type="pil", label="Upload an Image"),17 outputs=gr.outputs.Image(type="pil", label="Processed Image"),18 title="Form understanding using Multimodal Transformers",19 examples=examples,20 description="Upload an image, and the app will process it using the LayoutLMV3 multimodal transformer. You can get all the OCR tags marked in the image as output.",21 theme="huggingface", # You can use "default", "compact", or "huggingface" themes22 layout="vertical",23 live=True,24)25 26if __name__ == "__main__":27 iface.launch()28 