File size: 1,671 Bytes
baa7db6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from gradio_leaderboard import Leaderboard, SearchColumns, SelectColumns, ColumnFilter
from src.leaderboard.read_evals import FILTERED_ONLY_FIELD
from src.envs import EVAL_RESULTS_PATH
from src.populate import get_leaderboard_df
from src.display.utils import (
    AutoEvalColumn,
    fields,
)

def show_result_page(root_path: str, title: str, index: int):
    raw_data, original_df = get_leaderboard_df(EVAL_RESULTS_PATH + f"/{root_path}")
    leaderboard_df = original_df.copy()
    with gr.TabItem(title, elem_id="llm-benchmark-tab-table", id=index):
        return Leaderboard(
            value=leaderboard_df,
            datatype=[c.type for c in fields(AutoEvalColumn)],
            select_columns=SelectColumns(
                default_selection=[c for c in list(original_df.keys())],
                cant_deselect=[c.name for c in fields(AutoEvalColumn)],
                label="Select Columns to show:",
            ),
            hide_columns=FILTERED_ONLY_FIELD,
            search_columns=SearchColumns(
                primary_column=AutoEvalColumn.model.name,
                secondary_columns=[],
                placeholder="🔍 Search for your model (separate multiple queries with `;`) and press ENTER...",
                label="Search",
            ),
            filter_columns=[
                ColumnFilter(
                    'params',
                    type="slider",
                    min=0.01,
                    max=150,
                    label="Select the number of parameters (B)",
                ),
            ],
            bool_checkboxgroup_label="Hide models",
            interactive=False,
        )