basma-b commited on
Commit
dd2a905
·
verified ·
1 Parent(s): 70a1f44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -10,6 +10,16 @@ from src.display.utils import COLS, AutoEvalColumn, fields
10
  from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
11
  from src.populate import get_leaderboard_df
12
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  def restart_space():
15
  API.restart_space(repo_id=REPO_ID)
 
10
  from src.envs import API, EVAL_REQUESTS_PATH, EVAL_RESULTS_PATH, QUEUE_REPO, REPO_ID, RESULTS_REPO, TOKEN
11
  from src.populate import get_leaderboard_df
12
 
13
+ import threading
14
+ import time
15
+
16
+ def restart_space():
17
+ time.sleep(30 * 60) # 30 minutes
18
+ os._exit(0) # Force exit, HF will restart the space
19
+
20
+ # Start restart timer in background
21
+ threading.Thread(target=restart_space, daemon=True).start()
22
+
23
 
24
  def restart_space():
25
  API.restart_space(repo_id=REPO_ID)