Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
|
|
|
|
| 3 |
import pandas as pd
|
|
|
|
| 4 |
from huggingface_hub.repocard import metadata_load
|
| 5 |
-
from huggingface_hub import hf_hub_download, HfApi
|
| 6 |
-
import os
|
| 7 |
-
import json
|
| 8 |
|
| 9 |
|
| 10 |
def make_clickable_model(model_name, link=None):
|
|
@@ -14,15 +14,22 @@ def make_clickable_model(model_name, link=None):
|
|
| 14 |
# return (
|
| 15 |
# f'<a target="_blank" style="text-decoration: underline" href="{link}">{model_name.split("/")[-1]}</a>'
|
| 16 |
# )
|
| 17 |
-
return
|
| 18 |
-
f'<a target="_blank" style="text-decoration: underline" href="{link}">{model_name}</a>'
|
| 19 |
-
)
|
| 20 |
|
| 21 |
|
| 22 |
def add_rank(df):
|
| 23 |
-
cols_to_rank = [
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
if len(cols_to_rank) == 1:
|
| 27 |
df.sort_values(cols_to_rank[0], ascending=False, inplace=True)
|
| 28 |
else:
|
|
@@ -60,10 +67,7 @@ def get_vidore_data():
|
|
| 60 |
for dataset in results:
|
| 61 |
results[dataset] = {key: value for key, value in results[dataset].items() if "ndcg_at_5" in key}
|
| 62 |
|
| 63 |
-
MODEL_INFOS[model.modelId] = {
|
| 64 |
-
"metadata": meta,
|
| 65 |
-
"results": results
|
| 66 |
-
}
|
| 67 |
except:
|
| 68 |
continue
|
| 69 |
|
|
@@ -96,6 +100,7 @@ def add_rank_and_format(df):
|
|
| 96 |
df["Model"] = df["Model"].apply(make_clickable_model)
|
| 97 |
return df
|
| 98 |
|
|
|
|
| 99 |
# 1. Force headers to wrap
|
| 100 |
# 2. Force model column (maximum) width
|
| 101 |
# 3. Prevent model column from overflowing, scroll instead
|
|
@@ -124,7 +129,7 @@ table > tbody > tr > td:nth-child(2) > div {
|
|
| 124 |
def get_refresh_function():
|
| 125 |
def _refresh():
|
| 126 |
data_task_category = get_vidore_data()
|
| 127 |
-
return data_task_category
|
| 128 |
|
| 129 |
return _refresh
|
| 130 |
|
|
@@ -144,10 +149,11 @@ with gr.Blocks(css=css) as block:
|
|
| 144 |
gr.Markdown("# ViDoRe: The Visual Document Retrieval Benchmark ππ")
|
| 145 |
gr.Markdown("## From the paper - ColPali: Efficient Document Retrieval with Vision Language Models π")
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
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.
|
| 150 |
-
"""
|
|
|
|
| 151 |
|
| 152 |
with gr.Row():
|
| 153 |
datatype = ["number", "markdown"] + ["number"] * (NUM_DATASETS + 1)
|
|
@@ -155,22 +161,23 @@ with gr.Blocks(css=css) as block:
|
|
| 155 |
|
| 156 |
with gr.Row():
|
| 157 |
refresh_button = gr.Button("Refresh")
|
| 158 |
-
refresh_button.click(get_refresh_function(), inputs=None, outputs=dataframe,
|
| 159 |
-
concurrency_limit=20)
|
| 160 |
|
| 161 |
-
gr.Markdown(
|
|
|
|
| 162 |
- **Total Datasets**: {NUM_DATASETS}
|
| 163 |
- **Total Scores**: {NUM_SCORES}
|
| 164 |
- **Total Models**: {NUM_MODELS}
|
| 165 |
-
"""
|
|
|
|
| 166 |
Please consider citing:
|
| 167 |
|
| 168 |
```bibtex
|
| 169 |
-
|
| 170 |
```
|
| 171 |
-
"""
|
|
|
|
| 172 |
|
| 173 |
|
| 174 |
if __name__ == "__main__":
|
| 175 |
block.queue(max_size=10).launch(debug=True)
|
| 176 |
-
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import os
|
| 3 |
|
| 4 |
+
import gradio as gr
|
| 5 |
import pandas as pd
|
| 6 |
+
from huggingface_hub import HfApi, hf_hub_download
|
| 7 |
from huggingface_hub.repocard import metadata_load
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
def make_clickable_model(model_name, link=None):
|
|
|
|
| 14 |
# return (
|
| 15 |
# f'<a target="_blank" style="text-decoration: underline" href="{link}">{model_name.split("/")[-1]}</a>'
|
| 16 |
# )
|
| 17 |
+
return f'<a target="_blank" style="text-decoration: underline" href="{link}">{model_name}</a>'
|
|
|
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def add_rank(df):
|
| 21 |
+
cols_to_rank = [
|
| 22 |
+
col
|
| 23 |
+
for col in df.columns
|
| 24 |
+
if col
|
| 25 |
+
not in [
|
| 26 |
+
"Model",
|
| 27 |
+
"Model Size (Million Parameters)",
|
| 28 |
+
"Memory Usage (GB, fp32)",
|
| 29 |
+
"Embedding Dimensions",
|
| 30 |
+
"Max Tokens",
|
| 31 |
+
]
|
| 32 |
+
]
|
| 33 |
if len(cols_to_rank) == 1:
|
| 34 |
df.sort_values(cols_to_rank[0], ascending=False, inplace=True)
|
| 35 |
else:
|
|
|
|
| 67 |
for dataset in results:
|
| 68 |
results[dataset] = {key: value for key, value in results[dataset].items() if "ndcg_at_5" in key}
|
| 69 |
|
| 70 |
+
MODEL_INFOS[model.modelId] = {"metadata": meta, "results": results}
|
|
|
|
|
|
|
|
|
|
| 71 |
except:
|
| 72 |
continue
|
| 73 |
|
|
|
|
| 100 |
df["Model"] = df["Model"].apply(make_clickable_model)
|
| 101 |
return df
|
| 102 |
|
| 103 |
+
|
| 104 |
# 1. Force headers to wrap
|
| 105 |
# 2. Force model column (maximum) width
|
| 106 |
# 3. Prevent model column from overflowing, scroll instead
|
|
|
|
| 129 |
def get_refresh_function():
|
| 130 |
def _refresh():
|
| 131 |
data_task_category = get_vidore_data()
|
| 132 |
+
return add_rank_and_format(data_task_category)
|
| 133 |
|
| 134 |
return _refresh
|
| 135 |
|
|
|
|
| 149 |
gr.Markdown("# ViDoRe: The Visual Document Retrieval Benchmark ππ")
|
| 150 |
gr.Markdown("## From the paper - ColPali: Efficient Document Retrieval with Vision Language Models π")
|
| 151 |
|
| 152 |
+
gr.Markdown(
|
| 153 |
+
f"""
|
| 154 |
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.
|
| 155 |
+
"""
|
| 156 |
+
)
|
| 157 |
|
| 158 |
with gr.Row():
|
| 159 |
datatype = ["number", "markdown"] + ["number"] * (NUM_DATASETS + 1)
|
|
|
|
| 161 |
|
| 162 |
with gr.Row():
|
| 163 |
refresh_button = gr.Button("Refresh")
|
| 164 |
+
refresh_button.click(get_refresh_function(), inputs=None, outputs=dataframe, concurrency_limit=20)
|
|
|
|
| 165 |
|
| 166 |
+
gr.Markdown(
|
| 167 |
+
f"""
|
| 168 |
- **Total Datasets**: {NUM_DATASETS}
|
| 169 |
- **Total Scores**: {NUM_SCORES}
|
| 170 |
- **Total Models**: {NUM_MODELS}
|
| 171 |
+
"""
|
| 172 |
+
+ r"""
|
| 173 |
Please consider citing:
|
| 174 |
|
| 175 |
```bibtex
|
| 176 |
+
INSERT LATER
|
| 177 |
```
|
| 178 |
+
"""
|
| 179 |
+
)
|
| 180 |
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
block.queue(max_size=10).launch(debug=True)
|
|
|