File size: 324 Bytes
599cf8a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
from transformers import pipeline

pipe = pipeline(
    "image-classification",
    model="ariG23498/vit_base_patch16_224.orig_in21k_ft_in1k.ft_food101"
)

def classify(image):
    return pipe(image)[0]["label"]

demo = gr.Interface(fn=classify, inputs=gr.Image(type="pil"), outputs="text")
demo.launch()