Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Clémentine
commited on
Commit
·
b974197
1
Parent(s):
bf23d2b
removed queue updates from continuous calls
Browse files
app.py
CHANGED
@@ -173,7 +173,6 @@ def init_leaderboard(dataframe):
|
|
173 |
bool_checkboxgroup_label="Hide models",
|
174 |
)
|
175 |
|
176 |
-
|
177 |
demo = gr.Blocks(css=custom_css)
|
178 |
with demo:
|
179 |
gr.HTML(TITLE)
|
@@ -307,7 +306,6 @@ with demo:
|
|
307 |
)
|
308 |
|
309 |
demo.load(fn=get_latest_data_leaderboard, inputs=None, outputs=[leaderboard])
|
310 |
-
demo.load(fn=get_latest_data_queue, inputs=None, outputs=[finished_eval_table, running_eval_table, pending_eval_table])
|
311 |
|
312 |
demo.queue(default_concurrency_limit=40)
|
313 |
|
@@ -357,16 +355,17 @@ async def update_leaderboard(payload: WebhookPayload) -> None:
|
|
357 |
verification_mode="no_checks"
|
358 |
)
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
|
|
371 |
|
372 |
webhooks_server.launch()
|
|
|
173 |
bool_checkboxgroup_label="Hide models",
|
174 |
)
|
175 |
|
|
|
176 |
demo = gr.Blocks(css=custom_css)
|
177 |
with demo:
|
178 |
gr.HTML(TITLE)
|
|
|
306 |
)
|
307 |
|
308 |
demo.load(fn=get_latest_data_leaderboard, inputs=None, outputs=[leaderboard])
|
|
|
309 |
|
310 |
demo.queue(default_concurrency_limit=40)
|
311 |
|
|
|
355 |
verification_mode="no_checks"
|
356 |
)
|
357 |
|
358 |
+
if False:
|
359 |
+
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
360 |
+
@webhooks_server.add_webhook
|
361 |
+
async def update_queue(payload: WebhookPayload) -> None:
|
362 |
+
"""Redownloads the queue dataset each time it updates"""
|
363 |
+
if payload.repo.type == "dataset" and payload.event.action == "update":
|
364 |
+
current_time = datetime.datetime.now()
|
365 |
+
if current_time - LAST_UPDATE_QUEUE > datetime.timedelta(minutes=10):
|
366 |
+
# We only redownload is last update was more than 10 minutes ago, as the queue is
|
367 |
+
# updated regularly and heavy to download
|
368 |
+
download_dataset(QUEUE_REPO, EVAL_REQUESTS_PATH)
|
369 |
+
LAST_UPDATE_QUEUE = datetime.datetime.now()
|
370 |
|
371 |
webhooks_server.launch()
|