Spaces:
Runtime error
Runtime error
Try to launch the full process
Browse files- app.py +1 -1
- 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=
|
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 |
-
|
180 |
if model.modelId not in models_names:
|
181 |
-
models.append(Model(
|
|
|
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 |
-
|
194 |
-
|
195 |
-
|
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"))
|
|
|
|
|
|
|
|
|
|