zhiqiulin commited on
Commit
2d904b5
·
verified ·
1 Parent(s): 8d21baa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -63,6 +63,16 @@ def rank_images(model_name, images, text):
63
 
64
  return ranked_images
65
 
 
 
 
 
 
 
 
 
 
 
66
  # Create the first demo
67
  demo_vqascore = gr.Interface(
68
  fn=generate, # function to call
@@ -71,6 +81,10 @@ demo_vqascore = gr.Interface(
71
  gr.Image(type="filepath"),
72
  gr.Textbox(label="Prompt")
73
  ], # define the types of inputs
 
 
 
 
74
  outputs="number", # define the type of output
75
  title="VQAScore", # title of the app
76
  description="This model evaluates the similarity between an image and a text prompt."
@@ -85,6 +99,9 @@ demo_vqascore_ranking = gr.Interface(
85
  gr.Textbox(label="Prompt")
86
  ], # define the types of inputs
87
  outputs=gr.Gallery(label="Ranked Images"), # define the type of output
 
 
 
88
  title="VQAScore Ranking", # title of the app
89
  description="This model ranks a gallery of images based on their similarity to a text prompt.",
90
  allow_flagging='never'
 
63
 
64
  return ranked_images
65
 
66
+
67
+ ### EXAMPLES ###
68
+ example_imgs = ["0_imgs/DALLE3.png",
69
+ "0_imgs/DeepFloyd.jpg",
70
+ "0_imgs/Midjourney.jpg",
71
+ "0_imgs/SDXL.jpg"]
72
+ example_prompt0 = "Two dogs of different breeds playfully chasing around a tree"
73
+ example_prompt1 = "Two dogs of the same breed playing on the grass"
74
+ ###
75
+
76
  # Create the first demo
77
  demo_vqascore = gr.Interface(
78
  fn=generate, # function to call
 
81
  gr.Image(type="filepath"),
82
  gr.Textbox(label="Prompt")
83
  ], # define the types of inputs
84
+ examples=[
85
+ ["clip-flant5-xxl", example_imgs[0], example_prompt0],
86
+ ["clip-flant5-xxl", example_imgs[0], example_prompt1],
87
+ ]
88
  outputs="number", # define the type of output
89
  title="VQAScore", # title of the app
90
  description="This model evaluates the similarity between an image and a text prompt."
 
99
  gr.Textbox(label="Prompt")
100
  ], # define the types of inputs
101
  outputs=gr.Gallery(label="Ranked Images"), # define the type of output
102
+ examples=[
103
+ ["clip-flant5-xxl", [(example_imgs[0], ""), (example_imgs[1], ""), (example_imgs[2], ""), (example_imgs[3], "")], example_prompt0],
104
+ ]
105
  title="VQAScore Ranking", # title of the app
106
  description="This model ranks a gallery of images based on their similarity to a text prompt.",
107
  allow_flagging='never'