File size: 474 Bytes
68c4602
 
 
 
 
 
 
 
 
 
 
 
 
70a751e
 
68c4602
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()