phenomenon1981 commited on
Commit
be4e9c1
1 Parent(s): 235a531

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -11,6 +11,14 @@ from threading import Thread
11
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", live=True)
13
 
 
 
 
 
 
 
 
 
14
  def reset_queue_periodically():
15
  start_time = time.time()
16
  while True:
 
11
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0", live=True)
13
 
14
+ def restart_script_periodically():
15
+ while True:
16
+ time.sleep(60) # 5 minutes
17
+ os.execl(sys.executable, sys.executable, *sys.argv)
18
+
19
+ restart_thread = Thread(target=restart_script_periodically, daemon=True)
20
+ restart_thread.start()
21
+
22
  def reset_queue_periodically():
23
  start_time = time.time()
24
  while True: