CLIP / app.py
sudhir2016's picture
Create app.py
8a25ce2
raw
history blame
474 Bytes
import gradio as gr
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]
Demo.launch()
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()