File size: 1,177 Bytes
f2625cd
f226f06
 
 
 
a677a59
523927e
 
 
 
 
d3c87a6
523927e
d3c87a6
 
4a46abc
10ad72f
 
 
f2625cd
0ef09d3
d3c87a6
0ef09d3
f2625cd
d3c87a6
 
 
 
 
 
 
 
 
 
 
10ad72f
f2625cd
 
10ad72f
 
6ed7668
4a46abc
4c5e550
 
10ad72f
4c5e550
4a46abc
523927e
 
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
# Add this at the top of your script
import warnings

warnings.filterwarnings("ignore")

import gradio as gr
from data_loader import (
    load_data,
    CATEGORIES,
    METHODOLOGY,
    HEADER_CONTENT,
    CARDS
)
from tabs.leaderboard_v1 import create_leaderboard_tab, filter_leaderboard
from tabs.leaderboard_v2 import create_leaderboard_v2_interface


def create_app():
    df = load_data()

    with gr.Blocks(
        theme=gr.themes.Default(primary_hue=gr.themes.colors.red)
    ) as app:
        with gr.Tabs():

            # Create v2 tab
            with gr.Tab("Leaderboard v2"):
                create_leaderboard_v2_interface()
                
            # Create v1 tab
            with gr.Tab("Leaderboard v1"):
                lb_output, lb_plot1, lb_plot2 = create_leaderboard_tab(
                    df, CATEGORIES, METHODOLOGY, HEADER_CONTENT, CARDS
                )


        # Initial loads
        app.load(
            fn=lambda: filter_leaderboard(
                df, "All", list(CATEGORIES.keys())[0], "Performance"
            ),
            outputs=[lb_output, lb_plot1, lb_plot2],
        )

    return app


demo = create_app()
demo.launch()