File size: 465 Bytes
6611bfa
3e31d99
6611bfa
 
 
 
4bb934d
6611bfa
8c67b0b
6611bfa
 
 
 
 
 
 
 
8c67b0b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr

# Define the function to predict using the model
def predict_image(img):
    model = gr.load("models/google/vit-base-patch16-224")
    return model.predict(img)

# Create the interface
iface = gr.Interface(
    fn=predict_image,
    inputs=gr.Image(),
    outputs="label",
    live=True,
    capture_session=True,
    title="Image recognition",
    description="Upload an image you want to categorize.",
    theme="Monochrome"
)

iface.launch()