import gradio as gr from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="openai/clip-vit-base-patch32") def predict(photo,Label1,Label2,Label3): out1= pipe(images=photo,candidate_labels=[Label1,Label2,Label3]) out2=out1[0] out3=out2['label'] return out3 label1='Apple' label2='Orange' label3='Banana' demo = gr.Interface(fn=predict,inputs=['pil','text','text','text'],outputs='text',examples=[['Banana.jpg',label1,label2,label3]]) demo.launch()