Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
·
1afc3c3
1
Parent(s):
1fc62a2
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,8 @@ import time
|
|
8 |
from queue import Queue
|
9 |
from threading import Thread
|
10 |
|
|
|
|
|
11 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
12 |
def get_prompts(prompt_text):
|
13 |
return text_gen(prompt_text)
|
@@ -40,13 +42,19 @@ def add_random_noise(prompt, noise_level=0.07):
|
|
40 |
|
41 |
|
42 |
def send_it1(inputs, noise_level, proc1=proc1):
|
|
|
|
|
|
|
|
|
43 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
44 |
while queue.qsize() >= queue_threshold:
|
45 |
time.sleep(2)
|
46 |
queue.put(prompt_with_noise)
|
47 |
output1 = proc1(prompt_with_noise)
|
|
|
48 |
return output1
|
49 |
|
|
|
50 |
def send_it2(inputs, noise_level, proc1=proc1):
|
51 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
52 |
while queue.qsize() >= queue_threshold:
|
|
|
8 |
from queue import Queue
|
9 |
from threading import Thread
|
10 |
|
11 |
+
generate_locked = False
|
12 |
+
|
13 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
14 |
def get_prompts(prompt_text):
|
15 |
return text_gen(prompt_text)
|
|
|
42 |
|
43 |
|
44 |
def send_it1(inputs, noise_level, proc1=proc1):
|
45 |
+
global generate_locked
|
46 |
+
if generate_locked:
|
47 |
+
return
|
48 |
+
generate_locked = True
|
49 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
50 |
while queue.qsize() >= queue_threshold:
|
51 |
time.sleep(2)
|
52 |
queue.put(prompt_with_noise)
|
53 |
output1 = proc1(prompt_with_noise)
|
54 |
+
generate_locked = False
|
55 |
return output1
|
56 |
|
57 |
+
|
58 |
def send_it2(inputs, noise_level, proc1=proc1):
|
59 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
60 |
while queue.qsize() >= queue_threshold:
|