TheXeos commited on
Commit
c159beb
โ€ข
2 Parent(s): 3da187b f99eb55

Merge remote-tracking branch 'origin/main'

Browse files
Files changed (3) hide show
  1. app.py +7 -11
  2. background_task.py +3 -1
  3. 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
- # ๐Ÿ† The Deep Reinforcement Learning Course Leaderboard ๐Ÿ†
25
 
26
- This is the leaderboard of trained agents during the Deep Reinforcement Learning Course. A free course from beginner to expert.
27
 
28
- This is the Soccer environment leaderboard, use Ctrl+F to find your rank ๐Ÿ†
29
 
30
- We use an ELO rating to sort the models.
31
- You **can click on the model's name** to be redirected to its model card which includes documentation.
32
 
33
- ๐Ÿค– You want to try to train your agents? <a href="http://eepurl.com/ic5ZUD" target="_blank">Sign up to the Hugging Face free Deep Reinforcement Learning Course ๐Ÿค— </a>.
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>'