File size: 2,301 Bytes
63f4228
 
 
 
 
 
 
 
 
 
 
c7c29e1
 
63f4228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Isolated functions to reload the leaderboard data and plot the results

from src.leaderboard_utils import filter_search, get_github_data
from src.plot_utils import split_models, compare_plots

def get_primary_leaderboard():
    '''
    Returns
        primary_leaderboard_df[0]: Dataframe containing the primary leaderboard (laterst version of the benchmark results)
    '''
    primary_leaderboard_df, _, _ = get_github_data()
    print("Reloading primary df: ")
    print(primary_leaderboard_df)
    return primary_leaderboard_df[0]

def get_open_models():
    '''
    Returns
        open_models: Checkbox group containing the open models
    '''
    primary_leaderboard_df, _, _ = get_github_data()
    temp_df = primary_leaderboard_df[0]
    models = list(temp_df[list(temp_df.columns)[0]].unique())
    open_models, _ = split_models(models)
    return open_models

def get_closed_models():
    '''
    Returns
        closed_models: Checkbox group containing the closed models
    '''
    primary_leaderboard_df, _, _ = get_github_data()
    temp_df = primary_leaderboard_df[0]
    models = list(temp_df[list(temp_df.columns)[0]].unique())
    _, closed_models = split_models(models)
    return closed_models

def get_plot_df():      
        '''
        Returns
            plot_df: Dataframe containing the results of latest version for plotting
        '''
        primary_leaderboard_df, _, _ = get_github_data()
        plot_df = primary_leaderboard_df[0]
        return plot_df
    
def get_version_names():
    '''
    Returns
        version_names: List containing the versions of the benchmark results for dropdown selection
    '''
    _, _, version_names = get_github_data()
    return version_names
    
def get_version_df():
    '''
    Returns
        version_dfs: Dataframe containing the benchmark results for all versions
    '''
    _, version_dfs, _ = get_github_data()
    return version_dfs

def get_prev_df(name='initial'):
    '''
    Returns
        prev_df: Dataframe containing the benchmark results for the previous versions (default = latest version)
    '''
    _, version_dfs, version_names = get_github_data()
    
    if name == 'initial':
        name = version_names[0]

    ind = version_names.index(name)
    prev_df = version_dfs[ind]
    return prev_df