File size: 4,681 Bytes
3fae107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8b4c92
3fae107
 
c8b4c92
3fae107
 
 
 
 
 
 
c8b4c92
 
3fae107
 
 
 
 
 
 
 
c8b4c92
3fae107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8b4c92
3fae107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8b4c92
3fae107
 
 
 
 
 
 
 
 
 
c8b4c92
3fae107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c8b4c92
3fae107
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
from utils import *

global data_component

def update_table(query, min_size, max_size, selected_tasks=None, selected_type="All"):
    df = get_df()
    if selected_type and selected_type != "All":
        df = df[df["Type"] == selected_type]
    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

with gr.Blocks() as block:
    gr.Markdown(LEADERBOARD_INTRODUCTION)
    
    with gr.Tabs(elem_classes="tab-buttons") as tabs:
        # Table 1
        with gr.TabItem("πŸ“Š VideoEval-Pro", elem_id="qa-tab-table1", id=1):
            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,
                    )

            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():
                type_select = gr.Dropdown(
                    choices=["All", "Proprietary", "Open-source"],
                    value="All",
                    label="Select Model Type",
                    elem_id="type-select"
                )

            with gr.Row():
                tasks_select = gr.CheckboxGroup(
                    choices=TASKS,
                    value=OPEN_TASKS,
                    label="Select tasks to Display",
                    elem_id="tasks-select"
                )

            data_component = gr.components.Dataframe(
                value=df[DEFAULT_NAMES],
                headers=DEFAULT_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, type_select], 
                outputs=data_component
            )
            min_size_slider.change(
                fn=update_with_tasks, 
                inputs=[search_bar, min_size_slider, max_size_slider, tasks_select, type_select], 
                outputs=data_component
            )
            max_size_slider.change(
                fn=update_with_tasks, 
                inputs=[search_bar, min_size_slider, max_size_slider, tasks_select, type_select], 
                outputs=data_component
            )
            tasks_select.change(
                fn=update_with_tasks, 
                inputs=[search_bar, min_size_slider, max_size_slider, tasks_select, type_select], 
                outputs=data_component
            )
            type_select.change(
                fn=update_with_tasks, 
                inputs=[search_bar, min_size_slider, max_size_slider, tasks_select, type_select], 
                outputs=data_component
            )
            refresh_button.click(fn=refresh_data, outputs=data_component)
            gr.Markdown(TABLE_INTRODUCTION)

        # table 2
        with gr.TabItem("πŸ“ About", elem_id="qa-tab-table2", id=2):
            gr.Markdown(LEADERBOARD_INFO, elem_classes="markdown-text")
            gr.Image("dataset_statistics.png", width=900, label="Dataset Statistics")

        # table 3
        with gr.TabItem("πŸš€ Submit here! ", elem_id="submit-tab", id=3):
            with gr.Row():
                gr.Markdown(SUBMIT_INTRODUCTION, elem_classes="markdown-text")

block.launch()