phenomenon1981 commited on
Commit
de6b696
1 Parent(s): 67294ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -7,10 +7,9 @@ import string
7
  import time
8
  from queue import Queue
9
  from threading import Thread
10
- import subprocess
11
 
12
  queue = Queue()
13
- queue_threshold = 10
14
 
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)
@@ -147,7 +146,13 @@ with gr.Blocks() as myface:
147
  run.click(send_it8, inputs=[prompt, noise_level], outputs=[output8])
148
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
149
 
150
- myface.queue(concurrency_count=30)
151
  myface.launch(enable_queue=True, inline=True)
 
 
 
 
 
152
 
153
-
 
 
 
7
  import time
8
  from queue import Queue
9
  from threading import Thread
 
10
 
11
  queue = Queue()
12
+ queue_threshold = 30
13
 
14
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
15
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0", live=True)
 
146
  run.click(send_it8, inputs=[prompt, noise_level], outputs=[output8])
147
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
148
 
 
149
  myface.launch(enable_queue=True, inline=True)
150
+ block.queue(concurrency_count=15, max_size=30).launch(max_threads=20)
151
+ def restart_script_periodically():
152
+ while True:
153
+ time.sleep(120) # 5 minutes
154
+ os.execl(sys.executable, sys.executable, *sys.argv)
155
 
156
+ restart_thread = Thread(target=restart_script_periodically, daemon=True)
157
+ restart_thread.start()
158
+ reset_queue_thread.join()