Spaces:
Running
Running
Change names and tab order
Browse files
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("π
|
63 |
-
gr.Markdown("# ViDoRe
|
64 |
-
gr.Markdown("###
|
65 |
|
66 |
gr.Markdown(
|
67 |
"""
|
68 |
-
Visual Document Retrieval Benchmark
|
69 |
|
70 |
-
Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics and models.
|
71 |
"""
|
72 |
)
|
73 |
-
|
74 |
|
75 |
with gr.Row():
|
76 |
-
|
77 |
-
|
78 |
placeholder="π Search Models... [press enter]",
|
79 |
label="Filter Models by Name",
|
80 |
)
|
81 |
-
|
82 |
-
choices=
|
83 |
)
|
84 |
|
85 |
with gr.Row():
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
def
|
90 |
model_handler.get_vidore_data(metric)
|
91 |
-
data = model_handler.compute_averages(metric, benchmark_version=
|
92 |
-
data = add_rank_and_format(data, benchmark_version=
|
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 |
-
|
101 |
-
|
102 |
-
get_refresh_function(model_handler, benchmark_version=
|
103 |
-
inputs=[
|
104 |
-
outputs=
|
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 |
-
|
118 |
-
get_refresh_function(model_handler, benchmark_version=
|
119 |
-
inputs=[
|
120 |
-
outputs=
|
121 |
)
|
122 |
-
|
123 |
-
lambda metric, search_term, selected_columns:
|
124 |
-
inputs=[
|
125 |
-
outputs=
|
126 |
)
|
127 |
-
|
128 |
-
lambda metric, search_term, selected_columns:
|
129 |
-
inputs=[
|
130 |
-
outputs=
|
131 |
)
|
132 |
|
133 |
gr.Markdown(
|
134 |
f"""
|
135 |
-
- **Total Datasets**: {
|
136 |
-
- **Total Scores**: {
|
137 |
-
- **Total Models**: {
|
138 |
"""
|
139 |
+ r"""
|
140 |
Please consider citing:
|
@@ -152,37 +144,37 @@ def main():
|
|
152 |
```
|
153 |
"""
|
154 |
)
|
155 |
-
with gr.TabItem("π
|
156 |
-
gr.Markdown("# ViDoRe:
|
157 |
-
gr.Markdown("###
|
158 |
|
159 |
gr.Markdown(
|
160 |
"""
|
161 |
-
Visual Document Retrieval Benchmark
|
162 |
|
163 |
-
Refer to the [ColPali paper](https://arxiv.org/abs/2407.01449) for details on metrics
|
164 |
"""
|
165 |
)
|
166 |
-
|
167 |
|
168 |
with gr.Row():
|
169 |
-
|
170 |
-
|
171 |
placeholder="π Search Models... [press enter]",
|
172 |
label="Filter Models by Name",
|
173 |
)
|
174 |
-
|
175 |
-
choices=
|
176 |
)
|
177 |
|
178 |
with gr.Row():
|
179 |
-
|
180 |
-
|
181 |
|
182 |
-
def
|
183 |
model_handler.get_vidore_data(metric)
|
184 |
-
data = model_handler.compute_averages(metric, benchmark_version=
|
185 |
-
data = add_rank_and_format(data, benchmark_version=
|
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 |
-
|
194 |
-
|
195 |
-
get_refresh_function(model_handler, benchmark_version=
|
196 |
-
inputs=[
|
197 |
-
outputs=
|
198 |
concurrency_limit=20,
|
199 |
)
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
# Automatically refresh the dataframe when the dropdown value changes
|
202 |
-
|
203 |
-
get_refresh_function(model_handler, benchmark_version=
|
204 |
-
inputs=[
|
205 |
-
outputs=
|
206 |
)
|
207 |
-
|
208 |
-
lambda metric, search_term, selected_columns:
|
209 |
-
inputs=[
|
210 |
-
outputs=
|
211 |
)
|
212 |
-
|
213 |
-
lambda metric, search_term, selected_columns:
|
214 |
-
inputs=[
|
215 |
-
outputs=
|
216 |
)
|
217 |
|
218 |
gr.Markdown(
|
219 |
f"""
|
220 |
-
- **Total Datasets**: {
|
221 |
-
- **Total Scores**: {
|
222 |
-
- **Total Models**: {
|
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(
|