Spaces:
Runtime error
Runtime error
Commit
·
a39938f
1
Parent(s):
9614796
Change restart interval
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
@@ -45,19 +46,20 @@ def restart_space():
|
|
| 45 |
|
| 46 |
def init_space():
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
|
|
|
| 61 |
|
| 62 |
raw_data, original_df = get_leaderboard_df(
|
| 63 |
results_path=EVAL_RESULTS_PATH, cols=COLS, benchmark_cols=BENCHMARK_COLS
|
|
@@ -369,7 +371,7 @@ with demo:
|
|
| 369 |
)
|
| 370 |
|
| 371 |
scheduler = BackgroundScheduler()
|
| 372 |
-
scheduler.add_job(restart_space, "interval", seconds=
|
| 373 |
scheduler.start()
|
| 374 |
|
| 375 |
demo.queue(default_concurrency_limit=40).launch()
|
|
|
|
| 1 |
+
from time import sleep
|
| 2 |
import gradio as gr
|
| 3 |
import pandas as pd
|
| 4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
|
|
|
| 46 |
|
| 47 |
def init_space():
|
| 48 |
|
| 49 |
+
try:
|
| 50 |
+
print(EVAL_RESULTS_PATH)
|
| 51 |
+
snapshot_download(
|
| 52 |
+
repo_id=RESULTS_REPO,
|
| 53 |
+
local_dir=EVAL_RESULTS_PATH,
|
| 54 |
+
repo_type="dataset",
|
| 55 |
+
tqdm_class=None,
|
| 56 |
+
etag_timeout=30,
|
| 57 |
+
resume_download=True,
|
| 58 |
+
)
|
| 59 |
+
except Exception as e:
|
| 60 |
+
print(e)
|
| 61 |
+
sleep(180) # sleep 3 min
|
| 62 |
+
restart_space()
|
| 63 |
|
| 64 |
raw_data, original_df = get_leaderboard_df(
|
| 65 |
results_path=EVAL_RESULTS_PATH, cols=COLS, benchmark_cols=BENCHMARK_COLS
|
|
|
|
| 371 |
)
|
| 372 |
|
| 373 |
scheduler = BackgroundScheduler()
|
| 374 |
+
scheduler.add_job(restart_space, "interval", seconds=1800) # restarted every 3h
|
| 375 |
scheduler.start()
|
| 376 |
|
| 377 |
demo.queue(default_concurrency_limit=40).launch()
|