Spaces:
Running
Running
File size: 2,798 Bytes
edb334d 396dfd7 f7b89d2 edb334d 228207a edb334d b931cb1 edb334d f7b89d2 edb334d f7b89d2 edb334d 396dfd7 edb334d f7b89d2 edb334d 100cbd5 edb334d f7b89d2 edb334d 587c0f6 edb334d f7b89d2 edb334d f7b89d2 edb334d f7b89d2 edb334d f7b89d2 edb334d f7b89d2 edb334d b931cb1 edb334d f7b89d2 edb334d f7b89d2 edb334d f7b89d2 edb334d f7b89d2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
from data.model_handler import ModelHandler
from app.utils import add_rank_and_format, get_refresh_function
import gradio as gr
METRICS = ["ndcg_at_5", "recall_at_1", "recall_at_5", "mrr_at_5"]
def main():
model_handler = ModelHandler()
initial_metric = "ndcg_at_5"
data = model_handler.get_vidore_data(initial_metric)
data = add_rank_and_format(data)
NUM_DATASETS = len(data.columns) - 3
NUM_SCORES = len(data) * NUM_DATASETS
NUM_MODELS = len(data)
css = """
table > thead {
white-space: normal
}
table {
--cell-width-1: 250px
}
table > tbody > tr > td:nth-child(2) > div {
overflow-x: auto
}
.filter-checkbox-group {
max-width: max-content;
}
"""
with gr.Blocks(css=css) as block:
gr.Markdown("# ViDoRe: The Visual Document Retrieval Benchmark ππ")
gr.Markdown("## From the paper - ColPali: Efficient Document Retrieval with Vision Language Models π")
gr.Markdown(
"""
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.
"""
)
#all_columns = list(data.columns)
#default_columns = all_columns
with gr.Row():
metric_dropdown = gr.Dropdown(choices=METRICS, value=initial_metric, label="Select Metric")
#column_checkboxes = gr.CheckboxGroup(choices=all_columns, value=default_columns, label="Select Columns to Display")
with gr.Row():
datatype = ["number", "markdown"] + ["number"] * (NUM_DATASETS + 1)
dataframe = gr.Dataframe(data, datatype=datatype, type="pandas")
with gr.Row():
refresh_button = gr.Button("Refresh")
refresh_button.click(get_refresh_function(), inputs=[metric_dropdown], outputs=dataframe, concurrency_limit=20)
# Automatically refresh the dataframe when the dropdown value changes
metric_dropdown.change(get_refresh_function(), inputs=[metric_dropdown], outputs=dataframe)
#column_checkboxes.change(get_refresh_function(), inputs=[metric_dropdown, column_checkboxes], outputs=dataframe)
gr.Markdown(
f"""
- **Total Datasets**: {NUM_DATASETS}
- **Total Scores**: {NUM_SCORES}
- **Total Models**: {NUM_MODELS}
"""
+ r"""
Please consider citing:
```bibtex
INSERT LATER
```
"""
)
block.queue(max_size=10).launch(debug=True)
if __name__ == "__main__":
main()
|