Spaces:
Sleeping
Sleeping
""" | |
Adapted from the SEED-Bench Leaderboard by AILab-CVC | |
Source: https://huggingface.co/spaces/AILab-CVC/SEED-Bench_Leaderboard | |
""" | |
import gradio as gr | |
import pandas as pd | |
from constants import * | |
global data_component, filter_component | |
def upload_file(files): | |
file_paths = [file.name for file in files] | |
return file_paths | |
def get_baseline_df(): | |
df = pd.read_csv(CSV_DIR) | |
df = df.sort_values(by=DEFAULT_SPLIT, ascending=False) | |
present_columns = MODEL_INFO + [DEFAULT_SPLIT] | |
df = df[present_columns] | |
# print(df) | |
return df | |
def get_all_df(): | |
df = pd.read_csv(CSV_DIR) | |
df = df.sort_values(by=DEFAULT_SPLIT, ascending=False) | |
# print(df) | |
return df | |
block = gr.Blocks() | |
with block: | |
gr.Markdown( | |
LEADERBORAD_INTRODUCTION | |
) | |
with gr.Tabs(elem_classes="tab-buttons") as tabs: | |
with gr.TabItem("🏅 EgoPlan Benchmark", elem_id="evalcrafter-benchmark-tab-table", id=0): | |
gr.Markdown( | |
TABLE_INTRODUCTION | |
) | |
dropdown_value = gr.inputs.Dropdown( | |
choices=SPLIT_INFO, | |
default=DEFAULT_SPLIT | |
) | |
# pdb.set_trace() | |
data_component = gr.components.Dataframe( | |
value=get_baseline_df, | |
headers=COLUMN_NAMES, | |
type="pandas", | |
datatype=DATA_TITILE_TYPE, | |
interactive=False, | |
visible=True, | |
) | |
def on_dropdown_value_change(selected_split): | |
# pdb.set_trace() | |
present_columns = MODEL_INFO + [selected_split] | |
updated_data = get_all_df()[present_columns].dropna() | |
updated_data = updated_data.sort_values(by=present_columns[-1], ascending=False) | |
updated_headers = present_columns | |
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers] | |
# pdb.set_trace() | |
filter_component = gr.components.Dataframe( | |
value=updated_data, | |
headers=updated_headers, | |
type="pandas", | |
datatype=update_datatype, | |
interactive=False, | |
visible=True, | |
) | |
# pdb.set_trace() | |
return filter_component.value | |
dropdown_value.change(fn=on_dropdown_value_change, inputs=dropdown_value, outputs=data_component) | |
# table 2 | |
with gr.TabItem("📝 About", elem_id="egoplan-benchmark-tab-table", id=2): | |
gr.Markdown(LEADERBORAD_INFO, elem_classes="markdown-text") | |
with gr.Row(): | |
data_run = gr.Button("Refresh") | |
data_run.click( | |
get_baseline_df, outputs=data_component | |
) | |
gr.Markdown(r""" | |
Please cite this paper if you find it useful ♥️: | |
```bibtex | |
@article{chen2023egoplan, | |
title={EgoPlan-Bench: Benchmarking Multimodal Large Language Models for Human-Level Planning}, | |
author={Chen, Yi and Ge, Yuying and Ge, Yixiao and Ding, Mingyu and Li, Bohao and Wang, Rui and Xu, Ruifeng and Shan, Ying and Liu, Xihui}, | |
journal={arXiv preprint arXiv:2312.06722}, | |
year={2023} | |
} | |
``` | |
""") | |
# block.load(get_baseline_df, outputs=data_title) | |
block.launch(share=False) |