TheXeos commited on
Commit
ba7d1ad
1 Parent(s): b810fb0

Try to launch the full process

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. background_task.py +6 -10
app.py CHANGED
@@ -15,7 +15,7 @@ api = HfApi()
15
 
16
  # launch
17
  scheduler = BackgroundScheduler()
18
- scheduler.add_job(func=init_matchmaking, trigger="interval", seconds=60)
19
  scheduler.start()
20
 
21
 
 
15
 
16
  # launch
17
  scheduler = BackgroundScheduler()
18
+ scheduler.add_job(func=init_matchmaking, trigger="interval", seconds=300)
19
  scheduler.start()
20
 
21
 
background_task.py CHANGED
@@ -176,9 +176,10 @@ def get_models_list() -> list:
176
  models.append(Model(row["author"], row["model"], row["elo"], row["games_played"]))
177
  models_names.append(row["model"])
178
  for model in models_on_hub:
179
- print("New model found: ", model.author, "-", model.modelId)
180
  if model.modelId not in models_names:
181
- models.append(Model(model.author, model.modelId))
 
182
  return models
183
 
184
 
@@ -190,12 +191,7 @@ def get_elo_data() -> pd.DataFrame:
190
 
191
  def init_matchmaking():
192
  models = get_models_list()
193
- # matchmaking = Matchmaking(models)
194
- # matchmaking.run()
195
- # matchmaking.to_csv()
196
  print("Matchmaking done ---", datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
197
-
198
-
199
- if __name__ == "__main__":
200
- print("It's running!")
201
- # init_matchmaking()
 
176
  models.append(Model(row["author"], row["model"], row["elo"], row["games_played"]))
177
  models_names.append(row["model"])
178
  for model in models_on_hub:
179
+ author, name = model.modelId.split("/")[0], model.modelId.split("/")[1]
180
  if model.modelId not in models_names:
181
+ models.append(Model(author, name))
182
+ print("New model found: ", author, "-", name)
183
  return models
184
 
185
 
 
191
 
192
  def init_matchmaking():
193
  models = get_models_list()
194
+ matchmaking = Matchmaking(models)
195
+ matchmaking.run()
196
+ matchmaking.to_csv()
197
  print("Matchmaking done ---", datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))