yangapku commited on
Commit
e4fced7
1 Parent(s): 529c2af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -6,20 +6,20 @@ from PIL import Image
6
 
7
 
8
  pipes = {
9
- "chinese-clip-vit-base-patch16": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-base-patch16"),
10
- "chinese-clip-vit-large-patch14": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-large-patch14"),
11
- "chinese-clip-vit-large-patch14-336px": pipeline("zero-shot-image-classification", model="OFA-Sys/chinese-clip-vit-large-patch14-336px"),
12
- "chinese-clip-vit-huge-patch14": 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
- "chinese-clip-vit-base-patch16",
19
- "chinese-clip-vit-large-patch14",
20
- "chinese-clip-vit-large-patch14-336px",
21
- "chinese-clip-vit-huge-patch14",
22
- ], type="value", default="chinese-clip-vit-base-patch16", label="Model"),
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