phenomenon1981 commited on
Commit
83cb010
1 Parent(s): a5d7254

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -7,6 +7,7 @@ import string
7
  import time
8
  from queue import Queue
9
  queue = Queue()
 
10
 
11
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
@@ -175,7 +176,14 @@ with gr.Blocks() as myface:
175
 
176
  myface.queue(concurrency_count=8)
177
  myface.launch(enable_queue=True, inline=True)
 
 
178
  while True:
179
  if queue.qsize() >= 15:
180
  queue.queue.clear()
181
  time.sleep(30)
 
 
 
 
 
 
7
  import time
8
  from queue import Queue
9
  queue = Queue()
10
+ from threading import Thread
11
 
12
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
13
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
 
176
 
177
  myface.queue(concurrency_count=8)
178
  myface.launch(enable_queue=True, inline=True)
179
+
180
+ def queue_monitor():
181
  while True:
182
  if queue.qsize() >= 15:
183
  queue.queue.clear()
184
  time.sleep(30)
185
+
186
+ monitor_thread = Thread(target=queue_monitor)
187
+ monitor_thread.start()
188
+
189
+ myface.launch(enable_queue=True, inline=True)