mrfakename commited on
Commit
656b8f3
·
verified ·
1 Parent(s): f4ce499

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
  import time
3
- import os, shutil, requests, zipfile, io
4
  from huggingface_hub import HfApi
5
  SECRET_KEY = os.getenv('SECRET', None)
6
  def restart_space():
@@ -11,7 +11,9 @@ def restart_space():
11
  time.sleep(60 * 60 * 3)
12
  print("Restarting space")
13
  api.restart_space(repo_id='mrfakename/sync_f5')
14
- restart_space()
 
 
15
  def refresh(token):
16
  if SECRET_KEY and token == SECRET_KEY:
17
  print("Clone repo")
 
1
  import gradio as gr
2
  import time
3
+ import os, shutil, requests, zipfile, io, threading
4
  from huggingface_hub import HfApi
5
  SECRET_KEY = os.getenv('SECRET', None)
6
  def restart_space():
 
11
  time.sleep(60 * 60 * 3)
12
  print("Restarting space")
13
  api.restart_space(repo_id='mrfakename/sync_f5')
14
+ restart_thread = threading.Thread(target=restart_space)
15
+ restart_thread.daemon = True
16
+ restart_thread.start()
17
  def refresh(token):
18
  if SECRET_KEY and token == SECRET_KEY:
19
  print("Clone repo")