File size: 1,095 Bytes
9aade84
84b9078
9aafde8
9aade84
 
 
 
84b9078
 
 
 
 
d9cc857
84b9078
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 = "<p style='text-align: center'><a href='https://huggingface.co/microsoft/dit-base-finetuned-rvlcdip' target='_blank'>Huggingface Model</a></p>"

pipe = pipeline(task="image-classification", 
                model="microsoft/dit-base-finetuned-rvlcdip")
gr.Interface.from_pipeline(pipe, 
                           title=title,
                           description=description,
                           examples=['coca_cola_advertisement.png', 'scientific_publication.png', 'letter.jpeg'],
                           article=article,
                           enable_queue=True,
                           ).launch()