Spaces:
Runtime error
Runtime error
Merge remote-tracking branch 'origin/main'
Browse files- app.py +7 -11
- background_task.py +3 -1
- utils.py +13 -0
app.py
CHANGED
@@ -3,6 +3,7 @@ from huggingface_hub import HfApi
|
|
3 |
from matchmaking import *
|
4 |
from background_task import init_matchmaking, get_elo_data
|
5 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
6 |
|
7 |
matchmaking = Matchmaking()
|
8 |
api = HfApi()
|
@@ -21,24 +22,19 @@ def update_elos():
|
|
21 |
|
22 |
with gr.Blocks() as block:
|
23 |
gr.Markdown(f"""
|
24 |
-
# ๐
|
25 |
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
You **can click on the model's name** to be redirected to its model card which includes documentation.
|
32 |
|
33 |
-
๐ค
|
34 |
-
|
35 |
-
You want to compare two agents? <a href="https://huggingface.co/spaces/ThomasSimonini/Compare-Reinforcement-Learning-Agents" target="_blank">It's possible using this Spaces demo ๐ </a>.
|
36 |
-
|
37 |
-
๐ง There is an **environment missing?** Please open an issue.
|
38 |
""")
|
39 |
with gr.Row():
|
40 |
output = gr.components.Dataframe(
|
41 |
-
value=get_elo_data
|
42 |
headers=["Ranking ๐", "User ๐ค", "Model id ๐ค", "ELO ๐", "Games played ๐ฎ"],
|
43 |
datatype=["number", "markdown", "markdown", "number", "number"]
|
44 |
)
|
|
|
3 |
from matchmaking import *
|
4 |
from background_task import init_matchmaking, get_elo_data
|
5 |
from apscheduler.schedulers.background import BackgroundScheduler
|
6 |
+
from utils import *
|
7 |
|
8 |
matchmaking = Matchmaking()
|
9 |
api = HfApi()
|
|
|
22 |
|
23 |
with gr.Blocks() as block:
|
24 |
gr.Markdown(f"""
|
25 |
+
# ๐ AI vs. AI SoccerTwos Leaderboard โฝ
|
26 |
|
27 |
+
In this leaderboard, you can find the ELO score and the rank of your trained model for the SoccerTwos environment.
|
28 |
|
29 |
+
If you want to know more about a model, just **copy the username and model and paste them into the search bar**.
|
30 |
|
31 |
+
๐ To visualize your agents competing check this demo: https://huggingface.co/spaces/unity/ML-Agents-SoccerTwos
|
|
|
32 |
|
33 |
+
๐ค For more information about this AI vs. AI challenge and to participate? Check: [ADD LINK].
|
|
|
|
|
|
|
|
|
34 |
""")
|
35 |
with gr.Row():
|
36 |
output = gr.components.Dataframe(
|
37 |
+
value=get_elo_data,
|
38 |
headers=["Ranking ๐", "User ๐ค", "Model id ๐ค", "ELO ๐", "Games played ๐ฎ"],
|
39 |
datatype=["number", "markdown", "markdown", "number", "number"]
|
40 |
)
|
background_task.py
CHANGED
@@ -4,6 +4,7 @@ import subprocess
|
|
4 |
import pandas as pd
|
5 |
from datetime import datetime
|
6 |
from huggingface_hub import HfApi, Repository
|
|
|
7 |
|
8 |
DATASET_REPO_URL = "https://huggingface.co/datasets/huggingface-projects/bot-fight-data"
|
9 |
DATASET_TEMP_REPO_URL = "https://huggingface.co/datasets/huggingface-projects/temp-match-results"
|
@@ -220,7 +221,8 @@ def get_elo_data() -> pd.DataFrame:
|
|
220 |
:return: ELO data as a pandas DataFrame
|
221 |
"""
|
222 |
repo.git_pull()
|
223 |
-
data = pd.read_csv(os.path.join(DATASET_REPO_URL, "resolve", "main", ELO_FILENAME))
|
|
|
224 |
return data
|
225 |
|
226 |
|
|
|
4 |
import pandas as pd
|
5 |
from datetime import datetime
|
6 |
from huggingface_hub import HfApi, Repository
|
7 |
+
from utils import *
|
8 |
|
9 |
DATASET_REPO_URL = "https://huggingface.co/datasets/huggingface-projects/bot-fight-data"
|
10 |
DATASET_TEMP_REPO_URL = "https://huggingface.co/datasets/huggingface-projects/temp-match-results"
|
|
|
221 |
:return: ELO data as a pandas DataFrame
|
222 |
"""
|
223 |
repo.git_pull()
|
224 |
+
data = pd.read_csv(os.path.join(DATASET_REPO_URL, "resolve", "main", ELO_FILENAME))
|
225 |
+
|
226 |
return data
|
227 |
|
228 |
|
utils.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Based on Omar Sanseviero work
|
2 |
+
# Make model clickable link
|
3 |
+
def make_clickable_model(model_name):
|
4 |
+
# remove user from model name
|
5 |
+
model_name_show = ' '.join(model_name.split('/')[1:])
|
6 |
+
|
7 |
+
link = "https://huggingface.co/" + model_name
|
8 |
+
return f'<a target="_blank" href="{link}">{model_name_show}</a>'
|
9 |
+
|
10 |
+
# Make user clickable link
|
11 |
+
def make_clickable_user(user_id):
|
12 |
+
link = "https://huggingface.co/" + user_id
|
13 |
+
return f'<a target="_blank" href="{link}">{user_id}</a>'
|