CoolFace
Apppublic

Sarath2002/Form_Understanding_sparkathon

sourceHugging Faceafl-3.0updated 3y agoView on Hugging Face
0likes
app.py31 linesDownload Raw Back to root
1import gradio as gr2from PIL import Image3from support import processor4import os5 6os.system("pip install -r requirements.txt")7os.system('chmod 777 /tmp')8os.system('apt-get update -y')9os.system('apt-get install tesseract-ocr -y')10os.system('pip install -q pytesseract')11 12def OCR_processor(input_image):13    ##input_image = Image.open(input_image)14    return processor(input_image)15 16examples =[['eg1.png'],['eg2.png'],['eg3.png']]17iface = gr.Interface(18    fn=OCR_processor,19    inputs=gr.inputs.Image(type="pil", label="Upload an Image"),20    outputs=gr.outputs.Image(type="pil", label="Processed Image"),21    title="Form understanding using Multimodal Transformers",22    examples=examples,23    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.",24    theme="huggingface",  # You can use "default", "compact", or "huggingface" themes25    layout="vertical",26    live=True,27)28 29if __name__ == "__main__":30    iface.launch()31