Spaces:
Runtime error
Runtime error
Download app.py from Sarath2002/Form_Understanding_sparkathon: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/Sarath2002/Form_Understanding_sparkathon/resolve/main/app.py
- Command line
-
hf download hf://spaces/Sarath2002/Form_Understanding_sparkathon/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Sarath2002/Form_Understanding_sparkathon/resolve/main/app.py
1.04 kB
| import gradio as gr | |
| from PIL import Image | |
| from support import processor | |
| import os | |
| os.system("pip install -r requirements.txt") | |
| os.system('chmod 777 /tmp') | |
| os.system('apt-get update -y') | |
| os.system('apt-get install tesseract-ocr -y') | |
| os.system('pip install -q pytesseract') | |
| def OCR_processor(input_image): | |
| ##input_image = Image.open(input_image) | |
| return processor(input_image) | |
| examples =[['eg1.png'],['eg2.png'],['eg3.png']] | |
| iface = gr.Interface( | |
| fn=OCR_processor, | |
| inputs=gr.inputs.Image(type="pil", label="Upload an Image"), | |
| outputs=gr.outputs.Image(type="pil", label="Processed Image"), | |
| title="Form understanding using Multimodal Transformers", | |
| examples=examples, | |
| 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.", | |
| theme="huggingface", # You can use "default", "compact", or "huggingface" themes | |
| layout="vertical", | |
| live=True, | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |