Spaces:
Paused
Paused
Update app.py
Browse files
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")
|