title and description
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
import numpy as np
|
|
@@ -15,8 +16,13 @@ def shot(image, labels_text):
|
|
| 15 |
hypothesis_template= "This is a photo of a {}")
|
| 16 |
return {dic["label"]: dic["score"] for dic in res}
|
| 17 |
|
| 18 |
-
iface = gr.Interface(shot,
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
iface.launch()
|
|
|
|
| 1 |
+
from turtle import title
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
import numpy as np
|
|
|
|
| 16 |
hypothesis_template= "This is a photo of a {}")
|
| 17 |
return {dic["label"]: dic["score"] for dic in res}
|
| 18 |
|
| 19 |
+
iface = gr.Interface(shot,
|
| 20 |
+
["image", "text"],
|
| 21 |
+
"label",
|
| 22 |
+
examples=[["dog.jpg", "dog,cat,bird"],
|
| 23 |
+
["germany.jpg", "germany,belgium,colombia"],
|
| 24 |
+
["colombia.jpg", "germany,belgium,colombia"]],
|
| 25 |
+
description="Add a picture and a list of labels separated by commas",
|
| 26 |
+
title="Zero-shot Image Classification")
|
| 27 |
|
| 28 |
iface.launch()
|