phenomenon1981 commited on
Commit
2d6d39c
1 Parent(s): 72b485b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -8,23 +8,20 @@ import time
8
  from queue import Queue
9
  from threading import Thread
10
 
11
- def stop_proc1_periodically():
 
 
 
12
  while True:
13
  time.sleep(60) # 5 minutes
14
- queue.queue.clear()
15
- proc1.kill()
16
 
17
- stop_proc1_thread = Thread(target=stop_proc1_periodically, daemon=True)
18
- stop_proc1_thread.start()
19
 
20
  queue = Queue()
21
  queue_threshold = 30
22
 
23
- text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
24
- proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
25
-
26
-
27
-
28
  queue_length_counter = 0
29
 
30
  def add_random_noise(prompt, noise_level=0.07):
 
8
  from queue import Queue
9
  from threading import Thread
10
 
11
+ text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
+ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.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
  queue = Queue()
23
  queue_threshold = 30
24
 
 
 
 
 
 
25
  queue_length_counter = 0
26
 
27
  def add_random_noise(prompt, noise_level=0.07):