Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
·
bae581b
1
Parent(s):
d8a36b0
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ import string
|
|
7 |
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):
|
@@ -44,7 +45,8 @@ def send_it1(inputs, noise_level, proc1=proc1):
|
|
44 |
while queue.qsize() >= queue_threshold:
|
45 |
time.sleep(2)
|
46 |
queue.put(prompt_with_noise)
|
47 |
-
|
|
|
48 |
return output1
|
49 |
|
50 |
def send_it2(inputs, noise_level, proc1=proc1):
|
@@ -52,7 +54,8 @@ def send_it2(inputs, noise_level, proc1=proc1):
|
|
52 |
while queue.qsize() >= queue_threshold:
|
53 |
time.sleep(2)
|
54 |
queue.put(prompt_with_noise)
|
55 |
-
|
|
|
56 |
return output2
|
57 |
|
58 |
def send_it3(inputs, noise_level, proc1=proc1):
|
|
|
7 |
import time
|
8 |
from queue import Queue
|
9 |
from threading import Thread
|
10 |
+
from concurrent.futures import ThreadPoolExecutor
|
11 |
|
12 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
13 |
def get_prompts(prompt_text):
|
|
|
45 |
while queue.qsize() >= queue_threshold:
|
46 |
time.sleep(2)
|
47 |
queue.put(prompt_with_noise)
|
48 |
+
with ThreadPoolExecutor() as executor:
|
49 |
+
output1 = executor.submit(proc1, prompt_with_noise).result()
|
50 |
return output1
|
51 |
|
52 |
def send_it2(inputs, noise_level, proc1=proc1):
|
|
|
54 |
while queue.qsize() >= queue_threshold:
|
55 |
time.sleep(2)
|
56 |
queue.put(prompt_with_noise)
|
57 |
+
with ThreadPoolExecutor() as executor:
|
58 |
+
output2 = executor.submit(proc1, prompt_with_noise).result()
|
59 |
return output2
|
60 |
|
61 |
def send_it3(inputs, noise_level, proc1=proc1):
|