Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ from queue import Queue
|
|
9 |
queue = Queue()
|
10 |
|
11 |
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 |
|
@@ -30,97 +29,6 @@ def add_random_noise(prompt, noise_level=0.07):
|
|
30 |
|
31 |
queue_length_counter = 0
|
32 |
|
33 |
-
def send_it1(inputs, noise_level, proc1=proc1):
|
34 |
-
global queue_length_counter
|
35 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
36 |
-
if queue_length_counter >= 15:
|
37 |
-
if not queue.empty():
|
38 |
-
queue.queue.clear()
|
39 |
-
queue_length_counter = 0
|
40 |
-
output1 = proc1(prompt_with_noise)
|
41 |
-
queue_length_counter += 1
|
42 |
-
time.sleep(3)
|
43 |
-
return output1
|
44 |
-
time.sleep(1)
|
45 |
-
|
46 |
-
def send_it2(inputs, noise_level, proc1=proc1):
|
47 |
-
global queue_length_counter
|
48 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
49 |
-
if queue_length_counter >= 15:
|
50 |
-
if not queue.empty():
|
51 |
-
queue.queue.clear()
|
52 |
-
queue_length_counter = 0
|
53 |
-
output2 = proc1(prompt_with_noise)
|
54 |
-
queue_length_counter += 1
|
55 |
-
time.sleep(3)
|
56 |
-
return output2
|
57 |
-
time.sleep(1)
|
58 |
-
|
59 |
-
def send_it3(inputs, noise_level, proc1=proc1):
|
60 |
-
global queue_length_counter
|
61 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
62 |
-
if queue_length_counter >= 15:
|
63 |
-
if not queue.empty():
|
64 |
-
queue.queue.clear()
|
65 |
-
queue_length_counter = 0
|
66 |
-
output3 = proc1(prompt_with_noise)
|
67 |
-
queue_length_counter += 1
|
68 |
-
time.sleep(3)
|
69 |
-
return output3
|
70 |
-
time.sleep(1)
|
71 |
-
|
72 |
-
def send_it4(inputs, noise_level, proc1=proc1):
|
73 |
-
global queue_length_counter
|
74 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
75 |
-
if queue_length_counter >= 15:
|
76 |
-
if not queue.empty():
|
77 |
-
queue.queue.clear()
|
78 |
-
queue_length_counter = 0
|
79 |
-
output4 = proc1(prompt_with_noise)
|
80 |
-
queue_length_counter += 1
|
81 |
-
time.sleep(3)
|
82 |
-
return output4
|
83 |
-
time.sleep(1)
|
84 |
-
|
85 |
-
def send_it5(inputs, noise_level, proc5=proc5):
|
86 |
-
global queue_length_counter
|
87 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
88 |
-
if queue_length_counter >= 15:
|
89 |
-
if not queue.empty():
|
90 |
-
queue.queue.clear()
|
91 |
-
queue_length_counter = 0
|
92 |
-
output5 = proc5(prompt_with_noise)
|
93 |
-
queue_length_counter += 1
|
94 |
-
time.sleep(3)
|
95 |
-
return output5
|
96 |
-
time.sleep(1)
|
97 |
-
|
98 |
-
def send_it6(inputs, noise_level, proc5=proc5):
|
99 |
-
global queue_length_counter
|
100 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
101 |
-
if queue_length_counter >= 15:
|
102 |
-
if not queue.empty():
|
103 |
-
queue.queue.clear()
|
104 |
-
queue_length_counter = 0
|
105 |
-
output6 = proc5(prompt_with_noise)
|
106 |
-
queue_length_counter += 1
|
107 |
-
time.sleep(3)
|
108 |
-
return output6
|
109 |
-
time.sleep(1)
|
110 |
-
|
111 |
-
def send_it7(inputs, noise_level, proc5=proc5):
|
112 |
-
global queue_length_counter
|
113 |
-
prompt_with_noise = add_random_noise(inputs, noise_level)
|
114 |
-
if queue_length_counter >= 15:
|
115 |
-
if not queue.empty():
|
116 |
-
queue.queue.clear()
|
117 |
-
queue_length_counter = 0
|
118 |
-
output7 = proc5(prompt_with_noise)
|
119 |
-
queue_length_counter += 1
|
120 |
-
time.sleep(3)
|
121 |
-
return output7
|
122 |
-
time.sleep(1)
|
123 |
-
|
124 |
def send_it8(inputs, noise_level, proc5=proc5):
|
125 |
global queue_length_counter
|
126 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
@@ -161,29 +69,10 @@ with gr.Blocks() as myface:
|
|
161 |
run=gr.Button("Generate")
|
162 |
|
163 |
with gr.Row():
|
164 |
-
like_message = gr.Button("❤️ Press the Like Button if you enjoy my space! ❤️")
|
165 |
-
with gr.Row():
|
166 |
-
output1=gr.Image(label="Dreamlike Photoreal 2.0")
|
167 |
-
output2=gr.Image(label="Dreamlike Photoreal 2.0")
|
168 |
-
with gr.Row():
|
169 |
-
output3=gr.Image(label="Dreamlike Photoreal 2.0")
|
170 |
-
output4=gr.Image(label="Dreamlike Photoreal 2.0")
|
171 |
-
with gr.Row():
|
172 |
-
output5=gr.Image(label="Dreamlike Diffusion 1.0")
|
173 |
-
output6=gr.Image(label="Dreamlike Diffusion 1.0")
|
174 |
-
with gr.Row():
|
175 |
-
output7=gr.Image(label="Dreamlike Diffusion 1.0")
|
176 |
output8=gr.Image(label="Dreamlike Diffusion 1.0")
|
177 |
|
178 |
|
179 |
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
180 |
-
run.click(send_it2, inputs=[prompt, noise_level], outputs=[output2])
|
181 |
-
run.click(send_it3, inputs=[prompt, noise_level], outputs=[output3])
|
182 |
-
run.click(send_it4, inputs=[prompt, noise_level], outputs=[output4])
|
183 |
-
run.click(send_it5, inputs=[prompt, noise_level], outputs=[output5])
|
184 |
-
run.click(send_it6, inputs=[prompt, noise_level], outputs=[output6])
|
185 |
-
run.click(send_it7, inputs=[prompt, noise_level], outputs=[output7])
|
186 |
-
run.click(send_it8, inputs=[prompt, noise_level], outputs=[output8])
|
187 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
188 |
|
189 |
|
|
|
9 |
queue = Queue()
|
10 |
|
11 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
|
|
12 |
proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
13 |
|
14 |
|
|
|
29 |
|
30 |
queue_length_counter = 0
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
def send_it8(inputs, noise_level, proc5=proc5):
|
33 |
global queue_length_counter
|
34 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
69 |
run=gr.Button("Generate")
|
70 |
|
71 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
output8=gr.Image(label="Dreamlike Diffusion 1.0")
|
73 |
|
74 |
|
75 |
run.click(send_it1, inputs=[prompt, noise_level], outputs=[output1])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
|
77 |
|
78 |
|