Spaces:
Running
Running
add restart and modify envs
Browse files- app.py +18 -18
- src/envs.py +1 -1
app.py
CHANGED
@@ -35,23 +35,23 @@ def restart_space():
|
|
35 |
API.restart_space(repo_id=REPO_ID)
|
36 |
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
# # LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
57 |
# df = pd.read_csv('LOTSAv2_EvalBenchmark(Long).csv')
|
@@ -276,6 +276,6 @@ with demo:
|
|
276 |
)
|
277 |
|
278 |
scheduler = BackgroundScheduler()
|
279 |
-
|
280 |
scheduler.start()
|
281 |
demo.queue(default_concurrency_limit=40).launch()
|
|
|
35 |
API.restart_space(repo_id=REPO_ID)
|
36 |
|
37 |
|
38 |
+
## Space initialisation
|
39 |
+
try:
|
40 |
+
print(EVAL_REQUESTS_PATH)
|
41 |
+
snapshot_download(
|
42 |
+
repo_id=QUEUE_REPO, local_dir=EVAL_REQUESTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30,
|
43 |
+
token=TOKEN
|
44 |
+
)
|
45 |
+
except Exception:
|
46 |
+
restart_space()
|
47 |
+
try:
|
48 |
+
print(EVAL_RESULTS_PATH)
|
49 |
+
snapshot_download(
|
50 |
+
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type="dataset", tqdm_class=None, etag_timeout=30,
|
51 |
+
token=TOKEN
|
52 |
+
)
|
53 |
+
except Exception:
|
54 |
+
restart_space()
|
55 |
|
56 |
# # LEADERBOARD_DF = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
57 |
# df = pd.read_csv('LOTSAv2_EvalBenchmark(Long).csv')
|
|
|
276 |
)
|
277 |
|
278 |
scheduler = BackgroundScheduler()
|
279 |
+
scheduler.add_job(restart_space, "interval", seconds=1800)
|
280 |
scheduler.start()
|
281 |
demo.queue(default_concurrency_limit=40).launch()
|
src/envs.py
CHANGED
@@ -6,7 +6,7 @@ from huggingface_hub import HfApi
|
|
6 |
# ----------------------------------
|
7 |
TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
|
8 |
|
9 |
-
OWNER = "
|
10 |
# ----------------------------------
|
11 |
|
12 |
REPO_ID = f"{OWNER}/GIFT-Eval"
|
|
|
6 |
# ----------------------------------
|
7 |
TOKEN = os.environ.get("HF_TOKEN") # A read/write token for your org
|
8 |
|
9 |
+
OWNER = "Salesforce" # Change to your org - don't forget to create a results and request dataset, with the correct format!
|
10 |
# ----------------------------------
|
11 |
|
12 |
REPO_ID = f"{OWNER}/GIFT-Eval"
|