phenomenon1981 commited on
Commit
f13f052
1 Parent(s): bfee544

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -15,17 +15,14 @@ queue_threshold = 30
15
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
16
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
17
 
18
- def restart_and_stop_periodically():
 
19
  while True:
20
  time.sleep(30) # 5 minutes
21
- queue.queue.clear()
22
- server = proc1.get_server()
23
- server.kill()
24
- text_gen.stop()
25
  os.execl(sys.executable, sys.executable, *sys.argv)
26
 
27
- restart_and_stop_thread = Thread(target=restart_and_stop_periodically, daemon=True)
28
- restart_and_stop_thread.start()
29
 
30
 
31
  def add_random_noise(prompt, noise_level=0.07):
 
15
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
16
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
17
 
18
+
19
+ def restart_script_periodically():
20
  while True:
21
  time.sleep(30) # 5 minutes
 
 
 
 
22
  os.execl(sys.executable, sys.executable, *sys.argv)
23
 
24
+ restart_thread = Thread(target=restart_script_periodically, daemon=True)
25
+ restart_thread.start()
26
 
27
 
28
  def add_random_noise(prompt, noise_level=0.07):