Spaces:
Running
Running
File size: 8,575 Bytes
2016488 6ae8aba 2016488 ba1590f 2016488 ba1590f 2016488 6ae8aba 2016488 5ba0435 392edcb 6ae8aba 5fe97ad 6ae8aba 5fe97ad 6ae8aba 5fe97ad 6ae8aba 392edcb 2016488 5ba0435 392edcb 5ba0435 74aafd0 5ba0435 74aafd0 6ae8aba 5ba0435 392edcb 5ba0435 74aafd0 5ba0435 74aafd0 5ba0435 392edcb 5ba0435 74aafd0 5ba0435 74aafd0 392edcb 74aafd0 392edcb 2016488 392edcb 74aafd0 |
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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
from utils import *
import utils_v2 as v2
global data_component
def update_table(query, min_size, max_size, selected_tasks=None):
df = get_df()
filtered_df = search_and_filter_models(df, query, min_size, max_size)
if selected_tasks and len(selected_tasks) > 0:
selected_columns = BASE_COLS + selected_tasks
filtered_df = filtered_df[selected_columns]
return filtered_df
def update_table_v2(query, min_size, max_size, selected_tasks=None):
df = v2.get_df()
filtered_df = v2.search_and_filter_models(df, query, min_size, max_size)
if selected_tasks and len(selected_tasks) > 0:
selected_columns = v2.BASE_COLS + selected_tasks
filtered_df = filtered_df[selected_columns]
return filtered_df
with gr.Blocks() as block:
gr.Markdown(LEADERBOARD_INTRODUCTION)
with gr.Tabs(elem_classes="tab-buttons") as tabs:
# Table 1, the main leaderboard of overall scores
with gr.TabItem("π MMEB (V2)", elem_id="qa-tab-table1", id=1):
with gr.Row():
with gr.Accordion("Citation", open=False):
citation_button2 = gr.Textbox(
value=v2.CITATION_BUTTON_TEXT,
label=CITATION_BUTTON_LABEL,
elem_id="citation-button",
lines=10,
)
gr.Markdown(v2.TABLE_INTRODUCTION)
with gr.Row():
search_bar2 = gr.Textbox(
placeholder="Search models...",
show_label=False,
elem_id="search-bar"
)
df2 = v2.get_df()
min_size2, max_size2 = get_size_range(df2)
with gr.Row():
min_size_slider2 = gr.Slider(
minimum=min_size2,
maximum=max_size2,
value=min_size2,
step=0.1,
label="Minimum number of parameters (B)",
)
max_size_slider2 = gr.Slider(
minimum=min_size2,
maximum=max_size2,
value=max_size2,
step=0.1,
label="Maximum number of parameters (B)",
)
data_component2 = gr.components.Dataframe(
value=df2[v2.COLUMN_NAMES],
headers=v2.COLUMN_NAMES,
type="pandas",
datatype=v2.DATA_TITLE_TYPE,
interactive=False,
visible=True,
max_height=2400,
)
refresh_button2 = gr.Button("Refresh")
def update_with_tasks_v2(*args):
return update_table_v2(*args)
search_bar2.change(
fn=update_with_tasks_v2,
inputs=[search_bar2, min_size_slider2, max_size_slider2],
outputs=data_component2
)
min_size_slider2.change(
fn=update_with_tasks_v2,
inputs=[search_bar2, min_size_slider2, max_size_slider2],
outputs=data_component2
)
max_size_slider2.change(
fn=update_with_tasks_v2,
inputs=[search_bar2, min_size_slider2, max_size_slider2],
outputs=data_component2
)
refresh_button2.click(fn=v2.refresh_data, outputs=data_component2)
# table 2, image scores only
with gr.TabItem("πΌοΈ Image", elem_id="qa-tab-table1", id=2):
gr.Markdown(v2.TABLE_INTRODUCTION_I)
data_component3 = gr.components.Dataframe(
value=v2.rank_models(df2[v2.COLUMN_NAMES_I], 'Image-Overall'),
headers=v2.COLUMN_NAMES_I,
type="pandas",
datatype=v2.DATA_TITLE_TYPE_I,
interactive=False,
visible=True,
max_height=2400,
)
# table 3, video scores only
with gr.TabItem("π½ Video", elem_id="qa-tab-table1", id=3):
gr.Markdown(v2.TABLE_INTRODUCTION_V)
data_component4 = gr.components.Dataframe(
value=v2.rank_models(df2[v2.COLUMN_NAMES_V], 'Video-Overall'),
headers=v2.COLUMN_NAMES_V,
type="pandas",
datatype=v2.DATA_TITLE_TYPE_V,
interactive=False,
visible=True,
max_height=2400,
)
# table 4, visual document scores only
with gr.TabItem("π Visual Doc", elem_id="qa-tab-table1", id=4):
gr.Markdown(v2.TABLE_INTRODUCTION_D)
data_component5 = gr.components.Dataframe(
value=v2.rank_models(df2[v2.COLUMN_NAMES_D], 'VisDoc'),
headers=v2.COLUMN_NAMES_D,
type="pandas",
datatype=v2.DATA_TITLE_TYPE_D,
interactive=False,
visible=True,
max_height=2400,
)
# table 5
with gr.TabItem("π About", elem_id="qa-tab-table2", id=5):
gr.Markdown(LEADERBOARD_INFO, elem_classes="markdown-text")
gr.Image("overview.png", width=900, label="Dataset Overview")
# table 6
with gr.TabItem("π Submit here! ", elem_id="submit-tab", id=6):
with gr.Row():
gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text")
# table 7
with gr.TabItem("π MMEB (Archived)", elem_id="qa-tab-table1", id=7):
with gr.Row():
with gr.Accordion("Citation", open=False):
citation_button = gr.Textbox(
value=CITATION_BUTTON_TEXT,
label=CITATION_BUTTON_LABEL,
elem_id="citation-button",
lines=10,
)
gr.Markdown(TABLE_INTRODUCTION)
with gr.Row():
search_bar = gr.Textbox(
placeholder="Search models...",
show_label=False,
elem_id="search-bar"
)
df = get_df()
min_size, max_size = get_size_range(df)
with gr.Row():
min_size_slider = gr.Slider(
minimum=min_size,
maximum=max_size,
value=min_size,
step=0.1,
label="Minimum number of parameters (B)",
)
max_size_slider = gr.Slider(
minimum=min_size,
maximum=max_size,
value=max_size,
step=0.1,
label="Maximum number of parameters (B)",
)
with gr.Row():
tasks_select = gr.CheckboxGroup(
choices=TASKS_V1,
value=TASKS_V1,
label="Select tasks to Display",
elem_id="tasks-select"
)
data_component = gr.components.Dataframe(
value=df[COLUMN_NAMES],
headers=COLUMN_NAMES,
type="pandas",
datatype=DATA_TITLE_TYPE,
interactive=False,
visible=True,
max_height=2400,
)
refresh_button = gr.Button("Refresh")
def update_with_tasks(*args):
return update_table(*args)
search_bar.change(
fn=update_with_tasks,
inputs=[search_bar, min_size_slider, max_size_slider, tasks_select],
outputs=data_component
)
min_size_slider.change(
fn=update_with_tasks,
inputs=[search_bar, min_size_slider, max_size_slider, tasks_select],
outputs=data_component
)
max_size_slider.change(
fn=update_with_tasks,
inputs=[search_bar, min_size_slider, max_size_slider, tasks_select],
outputs=data_component
)
tasks_select.change(
fn=update_with_tasks,
inputs=[search_bar, min_size_slider, max_size_slider, tasks_select],
outputs=data_component
)
refresh_button.click(fn=refresh_data, outputs=data_component)
block.launch(share=True) |