phenomenon1981 commited on
Commit
de57a21
1 Parent(s): 01d0666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -12,6 +12,14 @@ text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
13
  proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
14
 
 
 
 
 
 
 
 
 
15
  def add_random_noise(prompt, noise_level=0.07):
16
  # Get the percentage of characters to add as noise
17
  percentage_noise = noise_level * 5
@@ -26,13 +34,6 @@ def add_random_noise(prompt, noise_level=0.07):
26
  return "".join(prompt_list)
27
 
28
  queue_length_counter = 0
29
- start_time = time.time()
30
- while True:
31
- if time.time() - start_time > 180: # 180 seconds = 3 minutes
32
- queue.queue.clear()
33
- start_time = time.time()
34
- # do other stuff
35
- time.sleep(1)
36
 
37
  def send_it1(inputs, noise_level, proc1=proc1):
38
  global queue_length_counter
 
12
  proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
13
  proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
14
 
15
+ def reset_queue_periodically():
16
+ start_time = time.time()
17
+ while True:
18
+ if time.time() - start_time > 300: # 300 seconds = 5 minutes
19
+ queue.queue.clear()
20
+ start_time = time.time()
21
+ time.sleep(1)
22
+
23
  def add_random_noise(prompt, noise_level=0.07):
24
  # Get the percentage of characters to add as noise
25
  percentage_noise = noise_level * 5
 
34
  return "".join(prompt_list)
35
 
36
  queue_length_counter = 0
 
 
 
 
 
 
 
37
 
38
  def send_it1(inputs, noise_level, proc1=proc1):
39
  global queue_length_counter