Spaces:
Runtime error
Runtime error
Test model filter
Browse files- app.py +6 -6
- background_task.py +4 -3
app.py
CHANGED
|
@@ -23,13 +23,13 @@ matchmaking = Matchmaking()
|
|
| 23 |
api = HfApi()
|
| 24 |
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
-
loop = asyncio.get_event_loop()
|
| 31 |
-
loop.create_task(run_background_loop())
|
| 32 |
-
loop.run_forever()
|
| 33 |
|
| 34 |
|
| 35 |
def get_elo_data() -> pd.DataFrame:
|
|
|
|
| 23 |
api = HfApi()
|
| 24 |
|
| 25 |
|
| 26 |
+
scheduler = BackgroundScheduler()
|
| 27 |
+
scheduler.add_job(func=init_matchmaking, trigger="interval", seconds=15000)
|
| 28 |
+
scheduler.start()
|
| 29 |
|
| 30 |
+
# loop = asyncio.get_event_loop()
|
| 31 |
+
# loop.create_task(run_background_loop())
|
| 32 |
+
# loop.run_forever()
|
| 33 |
|
| 34 |
|
| 35 |
def get_elo_data() -> pd.DataFrame:
|
background_task.py
CHANGED
|
@@ -173,6 +173,7 @@ def get_models_list() -> list:
|
|
| 173 |
models.append(Model(row["author"], row["model"], row["elo"], row["games_played"]))
|
| 174 |
models_names.append(row["model"])
|
| 175 |
for model in models_on_hub:
|
|
|
|
| 176 |
if model.modelId not in models_names:
|
| 177 |
models.append(Model(model.author, model.modelId))
|
| 178 |
return models
|
|
@@ -180,9 +181,9 @@ def get_models_list() -> list:
|
|
| 180 |
|
| 181 |
def init_matchmaking():
|
| 182 |
models = get_models_list()
|
| 183 |
-
matchmaking = Matchmaking(models)
|
| 184 |
-
matchmaking.run()
|
| 185 |
-
matchmaking.to_csv()
|
| 186 |
print("Matchmaking done ---", datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
|
| 187 |
|
| 188 |
|
|
|
|
| 173 |
models.append(Model(row["author"], row["model"], row["elo"], row["games_played"]))
|
| 174 |
models_names.append(row["model"])
|
| 175 |
for model in models_on_hub:
|
| 176 |
+
print("New model found: ", model.author, model.modelId)
|
| 177 |
if model.modelId not in models_names:
|
| 178 |
models.append(Model(model.author, model.modelId))
|
| 179 |
return models
|
|
|
|
| 181 |
|
| 182 |
def init_matchmaking():
|
| 183 |
models = get_models_list()
|
| 184 |
+
# matchmaking = Matchmaking(models)
|
| 185 |
+
# matchmaking.run()
|
| 186 |
+
# matchmaking.to_csv()
|
| 187 |
print("Matchmaking done ---", datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"))
|
| 188 |
|
| 189 |
|