Spaces:
Sleeping
Sleeping
XufengDuan
commited on
Commit
•
d062868
1
Parent(s):
8067b48
update scripts
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ import src.populate as populate
|
|
13 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
14 |
import src.submission.submit as submit
|
15 |
import os
|
|
|
16 |
import spacy_transformers
|
17 |
|
18 |
TOKEN = os.environ.get("H4_TOKEN", None)
|
@@ -360,8 +361,8 @@ with demo:
|
|
360 |
|
361 |
|
362 |
# 在初始化完成后调用
|
363 |
-
original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
364 |
-
process_pending_evals()
|
365 |
|
366 |
# try:
|
367 |
# print(envs.EVAL_REQUESTS_PATH)
|
@@ -389,7 +390,15 @@ process_pending_evals()
|
|
389 |
pending_eval_queue_df,
|
390 |
) = populate.get_evaluation_queue_df(envs.EVAL_REQUESTS_PATH, utils.EVAL_COLS)
|
391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
scheduler = BackgroundScheduler()
|
|
|
393 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
394 |
scheduler.start()
|
395 |
demo.queue(default_concurrency_limit=40).launch()
|
|
|
13 |
from src.populate import get_evaluation_queue_df, get_leaderboard_df
|
14 |
import src.submission.submit as submit
|
15 |
import os
|
16 |
+
import datetime
|
17 |
import spacy_transformers
|
18 |
|
19 |
TOKEN = os.environ.get("H4_TOKEN", None)
|
|
|
361 |
|
362 |
|
363 |
# 在初始化完成后调用
|
364 |
+
# original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
365 |
+
# process_pending_evals()
|
366 |
|
367 |
# try:
|
368 |
# print(envs.EVAL_REQUESTS_PATH)
|
|
|
390 |
pending_eval_queue_df,
|
391 |
) = populate.get_evaluation_queue_df(envs.EVAL_REQUESTS_PATH, utils.EVAL_COLS)
|
392 |
|
393 |
+
|
394 |
+
|
395 |
+
def background_init_and_process():
|
396 |
+
global original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df
|
397 |
+
original_df, finished_eval_queue_df, running_eval_queue_df, pending_eval_queue_df = init_space()
|
398 |
+
process_pending_evals()
|
399 |
+
|
400 |
scheduler = BackgroundScheduler()
|
401 |
+
scheduler.add_job(background_init_and_process, 'date', run_date=datetime.datetime.now()) # 立即执行
|
402 |
scheduler.add_job(restart_space, "interval", seconds=1800)
|
403 |
scheduler.start()
|
404 |
demo.queue(default_concurrency_limit=40).launch()
|