File size: 1,349 Bytes
71ea432
d83b83b
71ea432
cddb1c1
513af34
71ea432
6ac0a0d
b62b9e0
6ac0a0d
280d02d
7a5e1aa
ba7d1ad
7a5e1aa
e155868
e50ab51
6ac0a0d
 
 
 
71ea432
24be325
9a866e7
24be325
9295100
24be325
9295100
24be325
9295100
24be325
9295100
9a866e7
 
 
a9f18b3
9a866e7
 
 
 
 
 
24be325
 
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
import gradio as gr
from huggingface_hub import HfApi
from matchmaking import *
from background_task import init_matchmaking, get_elo_data
from apscheduler.schedulers.background import BackgroundScheduler

matchmaking = Matchmaking()
api = HfApi()

# launch
scheduler = BackgroundScheduler()
scheduler.add_job(func=init_matchmaking, trigger="interval", seconds=300)
scheduler.start()


def update_elos():
    matchmaking.read_history()
    matchmaking.compute_elo()
    matchmaking.save_elo_data()


with gr.Blocks() as block:
    gr.Markdown(f"""
        # ๐Ÿ† AI vs. AI SoccerTwos Leaderboard โšฝ 

        In this leaderboard, you can find the ELO score and the rank of your trained model for the SoccerTwos environment.

         You **can click on the model's name** to be redirected to its model card page.

        ๐Ÿค– For more information about this AI vs. AI challenge and to participate? Check: [ADD LINK].
        """)
    with gr.Row():
        output = gr.components.Dataframe(
            value=get_elo_data,
            headers=["Ranking ๐Ÿ†", "User ๐Ÿค—", "Model id ๐Ÿค–", "ELO ๐Ÿš€", "Games played ๐ŸŽฎ"],
            datatype=["number", "markdown", "markdown", "number", "number"]
        )
    with gr.Row():
        refresh = gr.Button("Refresh")
        refresh.click(get_elo_data, inputs=[], outputs=output)

block.launch()