Spaces:
Sleeping
Sleeping
Commit
·
8a25ce2
1
Parent(s):
b310c19
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
pipe = pipeline("zero-shot-image-classification", model="openai/clip-vit-base-patch32")
|
3 |
+
def predict(photo,Label1,Label2,Label3):
|
4 |
+
out1= pipe(images=photo,candidate_labels=[Label1,Label2,Label3])
|
5 |
+
out2=out1[0]
|
6 |
+
Demo.launch()
|
7 |
+
out3=out2['label']
|
8 |
+
return out3
|
9 |
+
label1='Apple'
|
10 |
+
label2='Orange'
|
11 |
+
label3='Banana'
|
12 |
+
Demo = gr.Interface(fn=predict,inputs=['pil','text','text','text'],outputs='text',examples=[['Banana.jpg',label1,label2,label3]])
|
13 |
+
Demo.launch()
|