Update app.py
Browse files
app.py
CHANGED
@@ -6,20 +6,20 @@ from PIL import Image
|
|
6 |
|
7 |
|
8 |
pipes = {
|
9 |
-
"
|
10 |
-
"
|
11 |
-
"
|
12 |
-
"
|
13 |
}
|
14 |
inputs = [
|
15 |
gr.inputs.Image(type='pil'),
|
16 |
"text",
|
17 |
gr.inputs.Radio(choices=[
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
"
|
22 |
-
], type="value", default="
|
23 |
]
|
24 |
images="festival.jpg"
|
25 |
|
@@ -33,9 +33,9 @@ def shot(image, labels_text, model_name):
|
|
33 |
iface = gr.Interface(shot,
|
34 |
inputs,
|
35 |
"label",
|
36 |
-
examples=[["festival.jpg", "灯笼, 鞭炮, 对联"],
|
37 |
-
["cat-dog-music.png", "音乐表演, 体育运动"],
|
38 |
-
["football-match.jpg", "梅西, C罗, 马奎尔"]],
|
39 |
description="Add a picture and a list of labels separated by commas",
|
40 |
title="Zero-shot Image Classification")
|
41 |
|
|
|
6 |
|
7 |
|
8 |
pipes = {
|
9 |
+
"ViT/B-16": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-base-patch16"),
|
10 |
+
"ViT/L-14": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-large-patch14"),
|
11 |
+
"ViT/L-14@336px": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-large-patch14-336px"),
|
12 |
+
"ViT/H-14": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-huge-patch14"),
|
13 |
}
|
14 |
inputs = [
|
15 |
gr.inputs.Image(type='pil'),
|
16 |
"text",
|
17 |
gr.inputs.Radio(choices=[
|
18 |
+
"ViT/B-16",
|
19 |
+
"ViT/L-14",
|
20 |
+
"ViT/L-14@336px",
|
21 |
+
"ViT/H-14",
|
22 |
+
], type="value", default="ViT/B-16", label="Model"),
|
23 |
]
|
24 |
images="festival.jpg"
|
25 |
|
|
|
33 |
iface = gr.Interface(shot,
|
34 |
inputs,
|
35 |
"label",
|
36 |
+
examples=[["festival.jpg", "灯笼, 鞭炮, 对联", "ViT/B-16"],
|
37 |
+
["cat-dog-music.png", "音乐表演, 体育运动", "ViT/B-16"],
|
38 |
+
["football-match.jpg", "梅西, C罗, 马奎尔", "ViT/B-16"]],
|
39 |
description="Add a picture and a list of labels separated by commas",
|
40 |
title="Zero-shot Image Classification")
|
41 |
|