File size: 2,547 Bytes
d40e945
 
 
 
 
 
 
5d5cc81
d40e945
 
5d5cc81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d40e945
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
import gradio as gr
from .config import *
from .leaderboard import *
from .messages import *

with gr.Blocks() as leaderboard:
    gr.Markdown(LDESC)
    table = gr.HTML()  # Changed to HTML to support custom CSS
    reloadbtn = gr.Button("Refresh")
    with gr.Row():
        with gr.Column(scale=1):
            reveal_prelim = gr.Checkbox(
                label="Reveal preliminary results",
                info="Show all models, including models with very few human ratings.",
            )
        with gr.Column(scale=1):
            hide_battle_votes = gr.Checkbox(
                label="Hide Battle Mode votes",
                info="Exclude votes obtained through Battle Mode.",
            )
        with gr.Column(scale=1):
            sort_by_elo = gr.Checkbox(
                label="Sort by Arena Score",
                info="Sort models by Arena Score instead of win rate",
                value=False,
            )
        with gr.Column(scale=1):
            hide_proprietary = gr.Checkbox(
                label="Hide proprietary models",
                info="Show only open models",
                value=False,
            )

    def update_leaderboard(*args):
        return get_leaderboard(*args)

    reveal_prelim.input(update_leaderboard, 
                       inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                       outputs=[table])
    hide_battle_votes.input(update_leaderboard, 
                           inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                           outputs=[table])
    sort_by_elo.input(update_leaderboard, 
                      inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                      outputs=[table])
    hide_proprietary.input(update_leaderboard, 
                          inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                          outputs=[table])
    leaderboard.load(update_leaderboard, 
                    inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                    outputs=[table])
    reloadbtn.click(update_leaderboard, 
                    inputs=[reveal_prelim, hide_battle_votes, sort_by_elo, hide_proprietary], 
                    outputs=[table])
    # gr.Markdown("DISCLAIMER: The licenses listed may not be accurate or up to date, you are responsible for checking the licenses before using the models. Also note that some models may have additional usage restrictions.")