Hugues Sibille commited on
Commit
b931cb1
β€’
1 Parent(s): 228207a

fix: minor before refacto

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -149,19 +149,19 @@ def get_vidore_data():
149
 
150
  with open(result_path) as f:
151
  results = json.load(f)
152
- # keep only ndcg_at_5
153
  for dataset in results:
154
  results[dataset] = {key: value for key, value in results[dataset].items() if metric in key}
155
 
156
  MODEL_INFOS[model_name] = {"meta":meta, "results": results}
157
- except:
 
158
  continue
159
-
160
  model_res = {}
161
  df = None
162
  if len(MODEL_INFOS) > 0:
163
  for model in MODEL_INFOS.keys():
164
- print(model)
165
  res = MODEL_INFOS[model]["results"]
166
  dataset_res = {}
167
  for dataset in res.keys():
@@ -171,12 +171,11 @@ def get_vidore_data():
171
  model_res[model] = dataset_res
172
 
173
  df = pd.DataFrame(model_res).T
174
-
175
- # add average
176
- # df["average"] = df.mean(axis=1)
177
- # df = df.sort_values(by="average", ascending=False)
178
- # # round to 2 decimals
179
- # df = df.round(2)
180
  return df
181
 
182
 
@@ -219,11 +218,6 @@ def get_refresh_function():
219
 
220
  return _refresh
221
 
222
-
223
- def get_refresh_overall_function():
224
- return lambda: get_refresh_function()
225
-
226
-
227
  data = get_vidore_data()
228
  data = add_rank_and_format(data)
229
 
@@ -236,7 +230,7 @@ with gr.Blocks(css=css) as block:
236
  gr.Markdown("## From the paper - ColPali: Efficient Document Retrieval with Vision Language Models πŸ‘€")
237
 
238
  gr.Markdown(
239
- f"""
240
  Visual Document Retrieval Benchmark leaderboard. To submit, refer to the <a href="https://github.com/tonywu71/vidore-benchmark/" target="_blank" style="text-decoration: underline">ViDoRe GitHub repository</a>. Refer to the [ColPali paper](https://arxiv.org/abs/XXXX.XXXXX) for details on metrics, tasks and models.
241
  """
242
  )
 
149
 
150
  with open(result_path) as f:
151
  results = json.load(f)
152
+
153
  for dataset in results:
154
  results[dataset] = {key: value for key, value in results[dataset].items() if metric in key}
155
 
156
  MODEL_INFOS[model_name] = {"meta":meta, "results": results}
157
+ except Exception as e:
158
+ print(f"Error loading {model_name} - {e}")
159
  continue
160
+
161
  model_res = {}
162
  df = None
163
  if len(MODEL_INFOS) > 0:
164
  for model in MODEL_INFOS.keys():
 
165
  res = MODEL_INFOS[model]["results"]
166
  dataset_res = {}
167
  for dataset in res.keys():
 
171
  model_res[model] = dataset_res
172
 
173
  df = pd.DataFrame(model_res).T
174
+
175
+ #save model_infos
176
+ with open(model_infos_path, "w") as f:
177
+ json.dump(MODEL_INFOS, f)
178
+
 
179
  return df
180
 
181
 
 
218
 
219
  return _refresh
220
 
 
 
 
 
 
221
  data = get_vidore_data()
222
  data = add_rank_and_format(data)
223
 
 
230
  gr.Markdown("## From the paper - ColPali: Efficient Document Retrieval with Vision Language Models πŸ‘€")
231
 
232
  gr.Markdown(
233
+ """
234
  Visual Document Retrieval Benchmark leaderboard. To submit, refer to the <a href="https://github.com/tonywu71/vidore-benchmark/" target="_blank" style="text-decoration: underline">ViDoRe GitHub repository</a>. Refer to the [ColPali paper](https://arxiv.org/abs/XXXX.XXXXX) for details on metrics, tasks and models.
235
  """
236
  )