phenomenon1981 commited on
Commit
372fe65
1 Parent(s): 1a8fa9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -14,16 +14,6 @@ queue_threshold = 15
14
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
15
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
16
 
17
- def reset_queue_periodically():
18
- start_time = time.time()
19
- while True:
20
- if time.time() - start_time > 150: # 150 seconds
21
- queue.queue.clear()
22
- start_time = time.time()
23
-
24
- reset_queue_thread = Thread(target=reset_queue_periodically)
25
- reset_queue_thread.start()
26
-
27
 
28
  def add_random_noise(prompt, noise_level=0.07):
29
  # Get the percentage of characters to add as noise
@@ -160,5 +150,15 @@ with gr.Blocks() as myface:
160
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
161
 
162
  myface.queue(concurrency_count=15)
 
 
 
 
 
 
 
 
 
 
163
  myface.launch(enable_queue=True, inline=True)
164
  reset_queue_thread.join()
 
14
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
15
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
16
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  def add_random_noise(prompt, noise_level=0.07):
19
  # Get the percentage of characters to add as noise
 
150
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
151
 
152
  myface.queue(concurrency_count=15)
153
+
154
+ def reset_queue_periodically():
155
+ start_time = time.time()
156
+ while True:
157
+ if time.time() - start_time > 150: # 150 seconds
158
+ queue.queue.clear()
159
+ start_time = time.time()
160
+
161
+ reset_queue_thread = Thread(target=reset_queue_periodically)
162
+ reset_queue_thread.start()
163
  myface.launch(enable_queue=True, inline=True)
164
  reset_queue_thread.join()