manu commited on
Commit
d5a3f7a
Β·
verified Β·
1 Parent(s): ebac224

Change names and tab order

Browse files
Files changed (1) hide show
  1. app.py +79 -78
app.py CHANGED
@@ -59,37 +59,37 @@ def main():
59
 
60
  with gr.Blocks(css=css) as block:
61
  with gr.Tabs():
62
- with gr.TabItem("πŸ† Leaderboard Benchmark 2"):
63
- gr.Markdown("# ViDoRe 2: A new visual Document Retrieval Benchmark πŸ“šπŸ”")
64
- gr.Markdown("### A harder dataset benchmark for visual document retrieval πŸ‘€")
65
 
66
  gr.Markdown(
67
  """
68
- Visual Document Retrieval Benchmark 2 leaderboard. To submit results, refer to the corresponding tab.
69
 
70
- Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics and models.
71
  """
72
  )
73
- datasets_columns_2 = list(data_benchmark_2.columns[3:])
74
 
75
  with gr.Row():
76
- metric_dropdown_2 = gr.Dropdown(choices=METRICS, value=initial_metric, label="Select Metric")
77
- research_textbox_2 = gr.Textbox(
78
  placeholder="πŸ” Search Models... [press enter]",
79
  label="Filter Models by Name",
80
  )
81
- column_checkboxes_2 = gr.CheckboxGroup(
82
- choices=datasets_columns_2, value=datasets_columns_2, label="Select Columns to Display"
83
  )
84
 
85
  with gr.Row():
86
- datatype_2 = ["number", "markdown"] + ["number"] * (NUM_DATASETS_2 + 1)
87
- dataframe_2 = gr.Dataframe(data_benchmark_2, datatype=datatype_2, type="pandas")
88
 
89
- def update_data_2(metric, search_term, selected_columns):
90
  model_handler.get_vidore_data(metric)
91
- data = model_handler.compute_averages(metric, benchmark_version=2)
92
- data = add_rank_and_format(data, benchmark_version=2)
93
  data = filter_models(data, search_term)
94
  # data = remove_duplicates(data) # Add this line
95
  if selected_columns:
@@ -97,44 +97,36 @@ def main():
97
  return data
98
 
99
  with gr.Row():
100
- refresh_button_2 = gr.Button("Refresh")
101
- refresh_button_2.click(
102
- get_refresh_function(model_handler, benchmark_version=2),
103
- inputs=[metric_dropdown_2],
104
- outputs=dataframe_2,
105
  concurrency_limit=20,
106
  )
107
 
108
- with gr.Row():
109
- gr.Markdown(
110
- """
111
- **Note**: For now, all models were evaluated using the vidore-benchmark package and custom retrievers on our side.
112
- Those numbers are not numbers obtained from the organisations that released those models.
113
- """
114
- )
115
-
116
  # Automatically refresh the dataframe when the dropdown value changes
117
- metric_dropdown_2.change(
118
- get_refresh_function(model_handler, benchmark_version=2),
119
- inputs=[metric_dropdown_2],
120
- outputs=dataframe_2,
121
  )
122
- research_textbox_2.submit(
123
- lambda metric, search_term, selected_columns: update_data_2(metric, search_term, selected_columns),
124
- inputs=[metric_dropdown_2, research_textbox_2, column_checkboxes_2],
125
- outputs=dataframe_2,
126
  )
127
- column_checkboxes_2.change(
128
- lambda metric, search_term, selected_columns: update_data_2(metric, search_term, selected_columns),
129
- inputs=[metric_dropdown_2, research_textbox_2, column_checkboxes_2],
130
- outputs=dataframe_2,
131
  )
132
 
133
  gr.Markdown(
134
  f"""
135
- - **Total Datasets**: {NUM_DATASETS_2}
136
- - **Total Scores**: {NUM_SCORES_2}
137
- - **Total Models**: {NUM_MODELS_2}
138
  """
139
  + r"""
140
  Please consider citing:
@@ -152,37 +144,37 @@ def main():
152
  ```
153
  """
154
  )
155
- with gr.TabItem("πŸ† Leaderboard Benchmark 1"):
156
- gr.Markdown("# ViDoRe: The Visual Document Retrieval Benchmark 1 πŸ“šπŸ”")
157
- gr.Markdown("### From the paper - ColPali: Efficient Document Retrieval with Vision Language Models πŸ‘€")
158
 
159
  gr.Markdown(
160
  """
161
- Visual Document Retrieval Benchmark 1 leaderboard. To submit results, refer to the corresponding tab.
162
 
163
- Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics, tasks and models.
164
  """
165
  )
166
- datasets_columns_1 = list(data_benchmark_1.columns[3:])
167
 
168
  with gr.Row():
169
- metric_dropdown_1 = gr.Dropdown(choices=METRICS, value=initial_metric, label="Select Metric")
170
- research_textbox_1 = gr.Textbox(
171
  placeholder="πŸ” Search Models... [press enter]",
172
  label="Filter Models by Name",
173
  )
174
- column_checkboxes_1 = gr.CheckboxGroup(
175
- choices=datasets_columns_1, value=datasets_columns_1, label="Select Columns to Display"
176
  )
177
 
178
  with gr.Row():
179
- datatype_1 = ["number", "markdown"] + ["number"] * (NUM_DATASETS_1 + 1)
180
- dataframe_1 = gr.Dataframe(data_benchmark_1, datatype=datatype_1, type="pandas")
181
 
182
- def update_data_1(metric, search_term, selected_columns):
183
  model_handler.get_vidore_data(metric)
184
- data = model_handler.compute_averages(metric, benchmark_version=1)
185
- data = add_rank_and_format(data, benchmark_version=1)
186
  data = filter_models(data, search_term)
187
  # data = remove_duplicates(data) # Add this line
188
  if selected_columns:
@@ -190,36 +182,44 @@ def main():
190
  return data
191
 
192
  with gr.Row():
193
- refresh_button_1 = gr.Button("Refresh")
194
- refresh_button_1.click(
195
- get_refresh_function(model_handler, benchmark_version=1),
196
- inputs=[metric_dropdown_1],
197
- outputs=dataframe_1,
198
  concurrency_limit=20,
199
  )
200
 
 
 
 
 
 
 
 
 
201
  # Automatically refresh the dataframe when the dropdown value changes
202
- metric_dropdown_1.change(
203
- get_refresh_function(model_handler, benchmark_version=1),
204
- inputs=[metric_dropdown_1],
205
- outputs=dataframe_1,
206
  )
207
- research_textbox_1.submit(
208
- lambda metric, search_term, selected_columns: update_data_1(metric, search_term, selected_columns),
209
- inputs=[metric_dropdown_1, research_textbox_1, column_checkboxes_1],
210
- outputs=dataframe_1,
211
  )
212
- column_checkboxes_1.change(
213
- lambda metric, search_term, selected_columns: update_data_1(metric, search_term, selected_columns),
214
- inputs=[metric_dropdown_1, research_textbox_1, column_checkboxes_1],
215
- outputs=dataframe_1,
216
  )
217
 
218
  gr.Markdown(
219
  f"""
220
- - **Total Datasets**: {NUM_DATASETS_1}
221
- - **Total Scores**: {NUM_SCORES_1}
222
- - **Total Models**: {NUM_MODELS_1}
223
  """
224
  + r"""
225
  Please consider citing:
@@ -237,6 +237,7 @@ def main():
237
  ```
238
  """
239
  )
 
240
  with gr.TabItem("πŸ“š Submit your model"):
241
  gr.Markdown("# How to Submit a New Model to the Leaderboard")
242
  gr.Markdown(
 
59
 
60
  with gr.Blocks(css=css) as block:
61
  with gr.Tabs():
62
+ with gr.TabItem("πŸ† ViDoRe V1"):
63
+ gr.Markdown("# ViDoRe: The Visual Document Retrieval Benchmark 1 πŸ“šπŸ”")
64
+ gr.Markdown("### From the paper - ColPali: Efficient Document Retrieval with Vision Language Models πŸ‘€")
65
 
66
  gr.Markdown(
67
  """
68
+ Visual Document Retrieval Benchmark 1 leaderboard. To submit results, refer to the corresponding tab.
69
 
70
+ Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics, tasks and models.
71
  """
72
  )
73
+ datasets_columns_1 = list(data_benchmark_1.columns[3:])
74
 
75
  with gr.Row():
76
+ metric_dropdown_1 = gr.Dropdown(choices=METRICS, value=initial_metric, label="Select Metric")
77
+ research_textbox_1 = gr.Textbox(
78
  placeholder="πŸ” Search Models... [press enter]",
79
  label="Filter Models by Name",
80
  )
81
+ column_checkboxes_1 = gr.CheckboxGroup(
82
+ choices=datasets_columns_1, value=datasets_columns_1, label="Select Columns to Display"
83
  )
84
 
85
  with gr.Row():
86
+ datatype_1 = ["number", "markdown"] + ["number"] * (NUM_DATASETS_1 + 1)
87
+ dataframe_1 = gr.Dataframe(data_benchmark_1, datatype=datatype_1, type="pandas")
88
 
89
+ def update_data_1(metric, search_term, selected_columns):
90
  model_handler.get_vidore_data(metric)
91
+ data = model_handler.compute_averages(metric, benchmark_version=1)
92
+ data = add_rank_and_format(data, benchmark_version=1)
93
  data = filter_models(data, search_term)
94
  # data = remove_duplicates(data) # Add this line
95
  if selected_columns:
 
97
  return data
98
 
99
  with gr.Row():
100
+ refresh_button_1 = gr.Button("Refresh")
101
+ refresh_button_1.click(
102
+ get_refresh_function(model_handler, benchmark_version=1),
103
+ inputs=[metric_dropdown_1],
104
+ outputs=dataframe_1,
105
  concurrency_limit=20,
106
  )
107
 
 
 
 
 
 
 
 
 
108
  # Automatically refresh the dataframe when the dropdown value changes
109
+ metric_dropdown_1.change(
110
+ get_refresh_function(model_handler, benchmark_version=1),
111
+ inputs=[metric_dropdown_1],
112
+ outputs=dataframe_1,
113
  )
114
+ research_textbox_1.submit(
115
+ lambda metric, search_term, selected_columns: update_data_1(metric, search_term, selected_columns),
116
+ inputs=[metric_dropdown_1, research_textbox_1, column_checkboxes_1],
117
+ outputs=dataframe_1,
118
  )
119
+ column_checkboxes_1.change(
120
+ lambda metric, search_term, selected_columns: update_data_1(metric, search_term, selected_columns),
121
+ inputs=[metric_dropdown_1, research_textbox_1, column_checkboxes_1],
122
+ outputs=dataframe_1,
123
  )
124
 
125
  gr.Markdown(
126
  f"""
127
+ - **Total Datasets**: {NUM_DATASETS_1}
128
+ - **Total Scores**: {NUM_SCORES_1}
129
+ - **Total Models**: {NUM_MODELS_1}
130
  """
131
  + r"""
132
  Please consider citing:
 
144
  ```
145
  """
146
  )
147
+ with gr.TabItem("πŸ† ViDoRe V2"):
148
+ gr.Markdown("# ViDoRe V2: A new visual Document Retrieval Benchmark πŸ“šπŸ”")
149
+ gr.Markdown("### A harder dataset benchmark for visual document retrieval πŸ‘€")
150
 
151
  gr.Markdown(
152
  """
153
+ Visual Document Retrieval Benchmark 2 leaderboard. To submit results, refer to the corresponding tab.
154
 
155
+ Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics and models.
156
  """
157
  )
158
+ datasets_columns_2 = list(data_benchmark_2.columns[3:])
159
 
160
  with gr.Row():
161
+ metric_dropdown_2 = gr.Dropdown(choices=METRICS, value=initial_metric, label="Select Metric")
162
+ research_textbox_2 = gr.Textbox(
163
  placeholder="πŸ” Search Models... [press enter]",
164
  label="Filter Models by Name",
165
  )
166
+ column_checkboxes_2 = gr.CheckboxGroup(
167
+ choices=datasets_columns_2, value=datasets_columns_2, label="Select Columns to Display"
168
  )
169
 
170
  with gr.Row():
171
+ datatype_2 = ["number", "markdown"] + ["number"] * (NUM_DATASETS_2 + 1)
172
+ dataframe_2 = gr.Dataframe(data_benchmark_2, datatype=datatype_2, type="pandas")
173
 
174
+ def update_data_2(metric, search_term, selected_columns):
175
  model_handler.get_vidore_data(metric)
176
+ data = model_handler.compute_averages(metric, benchmark_version=2)
177
+ data = add_rank_and_format(data, benchmark_version=2)
178
  data = filter_models(data, search_term)
179
  # data = remove_duplicates(data) # Add this line
180
  if selected_columns:
 
182
  return data
183
 
184
  with gr.Row():
185
+ refresh_button_2 = gr.Button("Refresh")
186
+ refresh_button_2.click(
187
+ get_refresh_function(model_handler, benchmark_version=2),
188
+ inputs=[metric_dropdown_2],
189
+ outputs=dataframe_2,
190
  concurrency_limit=20,
191
  )
192
 
193
+ with gr.Row():
194
+ gr.Markdown(
195
+ """
196
+ **Note**: For now, all models were evaluated using the vidore-benchmark package and custom retrievers on our side.
197
+ Those numbers are not numbers obtained from the organisations that released those models.
198
+ """
199
+ )
200
+
201
  # Automatically refresh the dataframe when the dropdown value changes
202
+ metric_dropdown_2.change(
203
+ get_refresh_function(model_handler, benchmark_version=2),
204
+ inputs=[metric_dropdown_2],
205
+ outputs=dataframe_2,
206
  )
207
+ research_textbox_2.submit(
208
+ lambda metric, search_term, selected_columns: update_data_2(metric, search_term, selected_columns),
209
+ inputs=[metric_dropdown_2, research_textbox_2, column_checkboxes_2],
210
+ outputs=dataframe_2,
211
  )
212
+ column_checkboxes_2.change(
213
+ lambda metric, search_term, selected_columns: update_data_2(metric, search_term, selected_columns),
214
+ inputs=[metric_dropdown_2, research_textbox_2, column_checkboxes_2],
215
+ outputs=dataframe_2,
216
  )
217
 
218
  gr.Markdown(
219
  f"""
220
+ - **Total Datasets**: {NUM_DATASETS_2}
221
+ - **Total Scores**: {NUM_SCORES_2}
222
+ - **Total Models**: {NUM_MODELS_2}
223
  """
224
  + r"""
225
  Please consider citing:
 
237
  ```
238
  """
239
  )
240
+
241
  with gr.TabItem("πŸ“š Submit your model"):
242
  gr.Markdown("# How to Submit a New Model to the Leaderboard")
243
  gr.Markdown(