TheXeos commited on
Commit
463a806
1 Parent(s): d6a27fe

Add match history

Browse files
Files changed (1) hide show
  1. background_task.py +6 -2
background_task.py CHANGED
@@ -8,6 +8,7 @@ from huggingface_hub import HfApi, Repository
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"
10
  ELO_FILENAME = "soccer_elo.csv"
 
11
  TEMP_FILENAME = "results.csv"
12
  ELO_DIR = "soccer_elo"
13
  TEMP_DIR = "temp"
@@ -59,9 +60,8 @@ class Matchmaking:
59
  self.matches = {
60
  "model1": [],
61
  "model2": [],
62
- "result": [],
63
  "timestamp": [],
64
- "env": []
65
  }
66
 
67
  def run(self):
@@ -162,6 +162,10 @@ class Matchmaking:
162
  df = pd.DataFrame(data_dict)
163
  print(df.head())
164
  repo.git_pull()
 
 
 
 
165
  df.to_csv(os.path.join(ELO_DIR, ELO_FILENAME), index=False)
166
  repo.push_to_hub(commit_message="Update ELO")
167
 
 
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"
10
  ELO_FILENAME = "soccer_elo.csv"
11
+ HISTORY_FILENAME = "soccer_history.csv"
12
  TEMP_FILENAME = "results.csv"
13
  ELO_DIR = "soccer_elo"
14
  TEMP_DIR = "temp"
 
60
  self.matches = {
61
  "model1": [],
62
  "model2": [],
 
63
  "timestamp": [],
64
+ "result": [],
65
  }
66
 
67
  def run(self):
 
162
  df = pd.DataFrame(data_dict)
163
  print(df.head())
164
  repo.git_pull()
165
+ history = pd.read_csv(os.path.join(ELO_DIR, HISTORY_FILENAME))
166
+ new_history = pd.DataFrame(self.matches)
167
+ history = pd.concat([history, new_history])
168
+ history.to_csv(os.path.join(ELO_DIR, HISTORY_FILENAME), index=False)
169
  df.to_csv(os.path.join(ELO_DIR, ELO_FILENAME), index=False)
170
  repo.push_to_hub(commit_message="Update ELO")
171