zhiqiulin commited on
Commit
35953b3
1 Parent(s): 629d398

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -90,31 +90,31 @@ demo_vqascore = gr.Interface(
90
  description="This model evaluates the similarity between an image and a text prompt."
91
  )
92
 
93
- # Create the second demo
94
- demo_vqascore_ranking = gr.Interface(
95
- fn=rank_images, # function to call
96
- inputs=[
97
- gr.Dropdown(["clip-flant5-xl", "clip-flant5-xxl"], label="Model Name"),
98
- gr.Gallery(label="Generated Images"),
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-xl", [[img, ""] for img in example_imgs], example_prompt0],
104
- ["clip-flant5-xl", [[img, ""] for img in example_imgs], example_prompt1]
105
 
106
- ],
107
- title="VQAScore Ranking", # title of the app
108
- description="This model ranks a gallery of images based on their similarity to a text prompt.",
109
- allow_flagging='never'
110
- )
111
 
112
- # Custom component for loading examples
113
- def load_example(model_name, images, prompt):
114
- return model_name, images, prompt
115
 
116
  # Create the second demo
117
- with gr.Blocks() as demo_vqascore_ranking_beta:
118
  gr.Markdown("# VQAScore Ranking\nThis model ranks a gallery of images based on their similarity to a text prompt.")
119
  model_dropdown = gr.Dropdown(["clip-flant5-xl", "clip-flant5-xxl"], label="Model Name")
120
  gallery = gr.Gallery(label="Generated Images", elem_id="input-gallery", columns=4, allow_preview=True)
@@ -139,7 +139,7 @@ with gr.Blocks() as demo_vqascore_ranking_beta:
139
 
140
 
141
  # Combine the demos into a tabbed interface
142
- tabbed_interface = gr.TabbedInterface([demo_vqascore, demo_vqascore_ranking, demo_vqascore_ranking_beta], ["VQAScore", "VQAScore Ranking", "Ranking Beta"])
143
 
144
  # Launch the tabbed interface
145
  tabbed_interface.queue()
 
90
  description="This model evaluates the similarity between an image and a text prompt."
91
  )
92
 
93
+ # # Create the second demo
94
+ # demo_vqascore_ranking = gr.Interface(
95
+ # fn=rank_images, # function to call
96
+ # inputs=[
97
+ # gr.Dropdown(["clip-flant5-xl", "clip-flant5-xxl"], label="Model Name"),
98
+ # gr.Gallery(label="Generated Images"),
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-xl", [[img, ""] for img in example_imgs], example_prompt0],
104
+ # ["clip-flant5-xl", [[img, ""] for img in example_imgs], example_prompt1]
105
 
106
+ # ],
107
+ # title="VQAScore Ranking", # title of the app
108
+ # description="This model ranks a gallery of images based on their similarity to a text prompt.",
109
+ # allow_flagging='never'
110
+ # )
111
 
112
+ # # Custom component for loading examples
113
+ # def load_example(model_name, images, prompt):
114
+ # return model_name, images, prompt
115
 
116
  # Create the second demo
117
+ with gr.Blocks() as demo_vqascore_ranking:
118
  gr.Markdown("# VQAScore Ranking\nThis model ranks a gallery of images based on their similarity to a text prompt.")
119
  model_dropdown = gr.Dropdown(["clip-flant5-xl", "clip-flant5-xxl"], label="Model Name")
120
  gallery = gr.Gallery(label="Generated Images", elem_id="input-gallery", columns=4, allow_preview=True)
 
139
 
140
 
141
  # Combine the demos into a tabbed interface
142
+ tabbed_interface = gr.TabbedInterface([demo_vqascore, demo_vqascore_ranking], ["VQAScore", "VQAScore Ranking"])
143
 
144
  # Launch the tabbed interface
145
  tabbed_interface.queue()