import gradio | |
from transformers import ViTForImageClassification | |
# Load the ViT model | |
model = ViTForImageClassification.from_pretrained("google/vit-base-patch16-224-in21k") | |
# Create a Gradio interface | |
interface = gradio.Interface( | |
fn=model, | |
inputs="image", | |
outputs=["label"], | |
title="ViT Image Classifier", | |
description="This Gradio app allows you to classify images using a Vision Transformer (ViT) model." | |
) | |
# Launch the Gradio app | |
interface.launch() | |