CoolFace
Apppublic

Msp/Document_Classification_DIT

sourceHugging Faceafl-3.0updated 4y agoView on Hugging Face
5likes
app.py16 linesDownload Raw Back to root
1import gradio as gr2from transformers import pipeline3 4title = "Document Image Transformer"5description = "Gradio Demo for DiT, the Document Image Transformer pre-trained on IIT-CDIP, a dataset that includes 42 million document images and fine-tuned on RVL-CDIP, a dataset consisting of 400,000 grayscale images in 16 classes, with 25,000 images per class. To use it, simply add your image, or click one of the examples to load them. Read more at the links below."6article = "<p style='text-align: center'><a href='https://huggingface.co/microsoft/dit-base-finetuned-rvlcdip' target='_blank'>Huggingface Model</a></p>"7 8pipe = pipeline(task="image-classification", 9                model="microsoft/dit-base-finetuned-rvlcdip")10gr.Interface.from_pipeline(pipe, 11                           title=title,12                           description=description,13                           examples=[ 'handwritten.jpeg', 'resume.jpeg','form.jpeg'],14                           article=article,15                           enable_queue=True,16                           ).launch()