terryyz commited on
Commit
c12bb85
1 Parent(s): 56f59ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -256,19 +256,24 @@ def run_gradio():
256
  interface.launch(show_error=True)
257
 
258
 
 
 
 
 
 
259
  def restart_space():
260
  logging.info(f"Restarting space with repo ID: {REPO_ID}")
261
  try:
262
  # Now restart the space
263
  API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)
264
- scheduler.start(split="complete", subset="full", samples="", check_gt_only=True)
265
- scheduler.start(split="complete", subset="hard", samples="", check_gt_only=True)
266
  logging.info("Space restarted successfully.")
267
  except Exception as e:
268
  logging.error(f"Failed to restart space: {e}")
269
 
270
 
271
  if __name__ == "__main__":
 
272
  run_gradio()
273
 
274
  scheduler = BackgroundScheduler()
 
256
  interface.launch(show_error=True)
257
 
258
 
259
+ def preload_gt():
260
+ scheduler.start(split="complete", subset="full", samples="", check_gt_only=True)
261
+ scheduler.start(split="complete", subset="hard", samples="", check_gt_only=True)
262
+
263
+
264
  def restart_space():
265
  logging.info(f"Restarting space with repo ID: {REPO_ID}")
266
  try:
267
  # Now restart the space
268
  API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)
269
+ preload_gt()
 
270
  logging.info("Space restarted successfully.")
271
  except Exception as e:
272
  logging.error(f"Failed to restart space: {e}")
273
 
274
 
275
  if __name__ == "__main__":
276
+ preload_gt()
277
  run_gradio()
278
 
279
  scheduler = BackgroundScheduler()