Spaces:
Runtime error
Runtime error
File size: 1,564 Bytes
7794cdb |
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 |
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
from utils import *
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.
If you want to know more about a model, just **copy the username and model and paste them into the search bar**.
๐ To visualize your agents competing check this demo: https://huggingface.co/spaces/unity/ML-Agents-SoccerTwos
๐ค For more information about this AI vs. AI challenge and to participate? [Check this](https://huggingface.co/deep-rl-course/unit7)
""")
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()
|