Spaces:
Running
Running
Commit
·
47a60e0
1
Parent(s):
05d123a
add restart_space func in app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ import logging
|
|
4 |
import pandas as pd
|
5 |
import gradio as gr
|
6 |
import multiprocessing
|
|
|
7 |
|
8 |
from src.backend import pull_search_results
|
9 |
from src.envs import (
|
10 |
-
API, START_COMMIT_ID,
|
11 |
HF_CACHE_DIR, SUBMIT_INFOS_DIR, SUBMIT_INFOS_FILE_NAME,
|
12 |
HF_SEARCH_RESULTS_REPO_DIR, HF_EVAL_RESULTS_REPO_DIR, SUBMIT_INFOS_REPO,
|
13 |
UNZIP_TARGET_DIR,
|
@@ -26,8 +27,8 @@ logging.basicConfig(
|
|
26 |
)
|
27 |
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
|
33 |
def load_submit_infos_df():
|
@@ -86,4 +87,9 @@ if __name__ == "__main__":
|
|
86 |
),
|
87 |
)
|
88 |
process.start()
|
|
|
|
|
|
|
|
|
|
|
89 |
demo.launch()
|
|
|
4 |
import pandas as pd
|
5 |
import gradio as gr
|
6 |
import multiprocessing
|
7 |
+
from apscheduler.schedulers.background import BackgroundScheduler
|
8 |
|
9 |
from src.backend import pull_search_results
|
10 |
from src.envs import (
|
11 |
+
API, START_COMMIT_ID, REPO_ID,
|
12 |
HF_CACHE_DIR, SUBMIT_INFOS_DIR, SUBMIT_INFOS_FILE_NAME,
|
13 |
HF_SEARCH_RESULTS_REPO_DIR, HF_EVAL_RESULTS_REPO_DIR, SUBMIT_INFOS_REPO,
|
14 |
UNZIP_TARGET_DIR,
|
|
|
27 |
)
|
28 |
|
29 |
|
30 |
+
def restart_space():
|
31 |
+
API.restart_space(repo_id=REPO_ID)
|
32 |
|
33 |
|
34 |
def load_submit_infos_df():
|
|
|
87 |
),
|
88 |
)
|
89 |
process.start()
|
90 |
+
|
91 |
+
scheduler = BackgroundScheduler()
|
92 |
+
scheduler.add_job(restart_space, "interval", seconds=1800)
|
93 |
+
scheduler.start()
|
94 |
+
demo.queue(default_concurrency_limit=40)
|
95 |
demo.launch()
|