phenomenon1981 commited on
Commit
a1033fd
1 Parent(s): 839e16a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -15,13 +15,15 @@ text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
15
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
16
 
17
 
18
- def restart_script_periodically():
19
  while True:
20
- time.sleep(600) # 5 minutes
21
- os.execl(sys.executable, sys.executable, *sys.argv)
 
 
 
 
22
 
23
- restart_thread = Thread(target=restart_script_periodically, daemon=True)
24
- restart_thread.start()
25
 
26
  queue_length_counter = 0
27
 
 
15
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
16
 
17
 
18
+ def stop_proc1_periodically():
19
  while True:
20
+ time.sleep(300) # 5 minutes
21
+ queue.queue.clear()
22
+ proc1.stop(timeout=30)
23
+
24
+ stop_proc1_thread = Thread(target=stop_proc1_periodically, daemon=True)
25
+ stop_proc1_thread.start()
26
 
 
 
27
 
28
  queue_length_counter = 0
29