import gradio as gr from transformers import pipeline title = "Document Image Transformer" description = "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." article = "
" pipe = pipeline(task="image-classification", model="microsoft/dit-base-finetuned-rvlcdip") gr.Interface.from_pipeline(pipe, title=title, description=description, examples=[ 'handwritten.jpeg', 'invoice.jpeg'], article=article, enable_queue=True, ).launch()