Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
·
06e88d2
1
Parent(s):
36f9aa1
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,16 @@ queue_threshold = 30
|
|
14 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
15 |
proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def add_random_noise(prompt, noise_level=0.07):
|
19 |
# Get the percentage of characters to add as noise
|
@@ -129,16 +139,6 @@ with gr.Blocks() as myface:
|
|
129 |
output7=gr.Image(label="Dreamlike-photoreal-2.0")
|
130 |
output8=gr.Image(label="Dreamlike-photoreal-2.0")
|
131 |
|
132 |
-
|
133 |
-
def reset_queue_periodically():
|
134 |
-
start_time = time.time()
|
135 |
-
while True:
|
136 |
-
if time.time() - start_time >= 120: # 5 minutes
|
137 |
-
queue.queue.clear()
|
138 |
-
start_time = time.time()
|
139 |
-
|
140 |
-
reset_queue_thread = Thread(target=reset_queue_periodically, daemon=True)
|
141 |
-
reset_queue_thread.start()
|
142 |
|
143 |
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
144 |
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
@@ -150,6 +150,6 @@ def reset_queue_periodically():
|
|
150 |
run.click(send_it8, inputs=[prompt, noise_level], outputs=[output8])
|
151 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
152 |
|
153 |
-
myface.
|
154 |
-
myface.
|
155 |
reset_queue_thread.join()
|
|
|
14 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
15 |
proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
|
16 |
|
17 |
+
def reset_queue_periodically():
|
18 |
+
start_time = time.time()
|
19 |
+
while True:
|
20 |
+
if time.time() - start_time >= 300: # 5 minutes
|
21 |
+
queue.queue.clear()
|
22 |
+
start_time = time.time()
|
23 |
+
|
24 |
+
reset_queue_thread = Thread(target=reset_queue_periodically, daemon=True)
|
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
|
|
|
139 |
output7=gr.Image(label="Dreamlike-photoreal-2.0")
|
140 |
output8=gr.Image(label="Dreamlike-photoreal-2.0")
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
144 |
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
|
|
150 |
run.click(send_it8, inputs=[prompt, noise_level], outputs=[output8])
|
151 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
152 |
|
153 |
+
myface.launch(enable_queue=True, inline=True)
|
154 |
+
myface.queue(concurrency_count=30)
|
155 |
reset_queue_thread.join()
|