zhiqiulin commited on
Commit
d6b74e1
·
verified ·
1 Parent(s): e570f26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -114,13 +114,25 @@ 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").style(grid=(2, 2), height="200px")
121
  prompt = gr.Textbox(label="Prompt")
122
  rank_button = gr.Button("Rank Images")
123
- ranked_gallery = gr.Gallery(label="Ranked Images with Scores", elem_id="ranked-gallery").style(grid=(2, 2), height="200px")
124
 
125
  rank_button.click(fn=rank_images, inputs=[model_dropdown, gallery, prompt], outputs=ranked_gallery)
126
 
 
114
  return model_name, images, prompt
115
 
116
  # Create the second demo
117
+ with gr.Blocks(css="""
118
+ .input-gallery .gallery-item img {
119
+ max-width: 100px;
120
+ height: auto;
121
+ }
122
+ .ranked-gallery .gallery-item img {
123
+ max-width: 100px;
124
+ height: auto;
125
+ }
126
+ .ranked-gallery .gallery-item div {
127
+ font-size: 20px;
128
+ }
129
+ """) as demo_vqascore_ranking_beta:
130
  gr.Markdown("# VQAScore Ranking\nThis model ranks a gallery of images based on their similarity to a text prompt.")
131
  model_dropdown = gr.Dropdown(["clip-flant5-xl", "clip-flant5-xxl"], label="Model Name")
132
+ gallery = gr.Gallery(label="Generated Images", elem_id="input-gallery", columns=3, height=200, allow_preview=True)
133
  prompt = gr.Textbox(label="Prompt")
134
  rank_button = gr.Button("Rank Images")
135
+ ranked_gallery = gr.Gallery(label="Ranked Images with Scores", elem_id="ranked-gallery", columns=3, height=200, allow_preview=True)
136
 
137
  rank_button.click(fn=rank_images, inputs=[model_dropdown, gallery, prompt], outputs=ranked_gallery)
138