import gradio as gr from transformers import pipeline title = "Document Classifier" description = "This machine has vision. It can read an image of a document and attempt to identify the text type of the document (e.g. letter; form; resume; scientific report). To test the machine, upload or drop an image of a document, submit and read the results. The results comprise a list of text types that the machine predicts is in the image. Beside a text type, the length of the bar indicates the confidence with which the machine sees the text type. The longer the bar, the more confident the machine is." pipe = pipeline(task='image-classification', model = "microsoft/dit-base-finetuned-rvlcdip") gr.Interface.from_pipeline(pipe, title=title, description=description, enable_queue=True).launch()