Spaces:
Runtime error
Runtime error
guess mode
Browse files
app.py
CHANGED
@@ -141,7 +141,7 @@ def process_canny(input_image, prompt, a_prompt, n_prompt, num_samples, image_re
|
|
141 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
142 |
"task": task_dic}
|
143 |
|
144 |
-
un_cond = {"c_concat":
|
145 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
146 |
shape = (4, H // 8, W // 8)
|
147 |
|
@@ -200,7 +200,7 @@ def process_hed(input_image, prompt, a_prompt, n_prompt, num_samples, image_reso
|
|
200 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
201 |
"task": task_dic}
|
202 |
|
203 |
-
un_cond = {"c_concat":
|
204 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
205 |
shape = (4, H // 8, W // 8)
|
206 |
|
@@ -257,7 +257,7 @@ def process_depth(input_image, prompt, a_prompt, n_prompt, num_samples, image_re
|
|
257 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
258 |
"task": task_dic}
|
259 |
|
260 |
-
un_cond = {"c_concat":
|
261 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
262 |
shape = (4, H // 8, W // 8)
|
263 |
|
@@ -316,7 +316,7 @@ def process_normal(input_image, prompt, a_prompt, n_prompt, num_samples, image_r
|
|
316 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
317 |
"task": task_dic}
|
318 |
|
319 |
-
un_cond = {"c_concat":
|
320 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
321 |
shape = (4, H // 8, W // 8)
|
322 |
|
@@ -374,7 +374,7 @@ def process_pose(input_image, prompt, a_prompt, n_prompt, num_samples, image_res
|
|
374 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
375 |
"task": task_dic}
|
376 |
|
377 |
-
un_cond = {"c_concat":
|
378 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
379 |
shape = (4, H // 8, W // 8)
|
380 |
|
@@ -432,7 +432,7 @@ def process_seg(input_image, prompt, a_prompt, n_prompt, num_samples, image_reso
|
|
432 |
cond = {"c_concat": [control],
|
433 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
434 |
"task": task_dic}
|
435 |
-
un_cond = {"c_concat":
|
436 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
437 |
shape = (4, H // 8, W // 8)
|
438 |
|
@@ -605,7 +605,7 @@ def process_bbox(input_image, prompt, a_prompt, n_prompt, num_samples, image_res
|
|
605 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
606 |
"task": task_dic}
|
607 |
|
608 |
-
un_cond = {"c_concat":
|
609 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
610 |
shape = (4, H // 8, W // 8)
|
611 |
|
@@ -664,7 +664,7 @@ def process_outpainting(input_image, prompt, a_prompt, n_prompt, num_samples, im
|
|
664 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
665 |
"task": task_dic}
|
666 |
|
667 |
-
un_cond = {"c_concat":
|
668 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
669 |
shape = (4, H // 8, W // 8)
|
670 |
|
@@ -743,7 +743,7 @@ def process_sketch(input_image, prompt, a_prompt, n_prompt, num_samples, image_r
|
|
743 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
744 |
"task": task_dic}
|
745 |
|
746 |
-
un_cond = {"c_concat":
|
747 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
748 |
shape = (4, H // 8, W // 8)
|
749 |
|
@@ -803,7 +803,7 @@ def process_colorization(input_image, prompt, a_prompt, n_prompt, num_samples, i
|
|
803 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
804 |
"task": task_dic}
|
805 |
|
806 |
-
un_cond = {"c_concat":
|
807 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
808 |
shape = (4, H // 8, W // 8)
|
809 |
|
@@ -861,7 +861,7 @@ def process_deblur(input_image, prompt, a_prompt, n_prompt, num_samples, image_r
|
|
861 |
cond = {"c_concat": [control],
|
862 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
863 |
"task": task_dic}
|
864 |
-
un_cond = {"c_concat":
|
865 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
866 |
shape = (4, H // 8, W // 8)
|
867 |
|
@@ -918,7 +918,7 @@ def process_inpainting(input_image, prompt, a_prompt, n_prompt, num_samples, ima
|
|
918 |
cond = {"c_concat": [control],
|
919 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
920 |
"task": task_dic}
|
921 |
-
un_cond = {"c_concat":
|
922 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
923 |
shape = (4, H // 8, W // 8)
|
924 |
|
@@ -1310,7 +1310,7 @@ with demo:
|
|
1310 |
strength, scale, seed, eta, condition_mode]
|
1311 |
run_button.click(fn=process_colorization, inputs=ips, outputs=[result_gallery])
|
1312 |
|
1313 |
-
with gr.TabItem("
|
1314 |
with gr.Row():
|
1315 |
gr.Markdown("## UniControl Stable Diffusion with Image Deblurring")
|
1316 |
with gr.Row():
|
|
|
141 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
142 |
"task": task_dic}
|
143 |
|
144 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
145 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
146 |
shape = (4, H // 8, W // 8)
|
147 |
|
|
|
200 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
201 |
"task": task_dic}
|
202 |
|
203 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
204 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
205 |
shape = (4, H // 8, W // 8)
|
206 |
|
|
|
257 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
258 |
"task": task_dic}
|
259 |
|
260 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
261 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
262 |
shape = (4, H // 8, W // 8)
|
263 |
|
|
|
316 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
317 |
"task": task_dic}
|
318 |
|
319 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
320 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
321 |
shape = (4, H // 8, W // 8)
|
322 |
|
|
|
374 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
375 |
"task": task_dic}
|
376 |
|
377 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
378 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
379 |
shape = (4, H // 8, W // 8)
|
380 |
|
|
|
432 |
cond = {"c_concat": [control],
|
433 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
434 |
"task": task_dic}
|
435 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
436 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
437 |
shape = (4, H // 8, W // 8)
|
438 |
|
|
|
605 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
606 |
"task": task_dic}
|
607 |
|
608 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
609 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
610 |
shape = (4, H // 8, W // 8)
|
611 |
|
|
|
664 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
665 |
"task": task_dic}
|
666 |
|
667 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
668 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
669 |
shape = (4, H // 8, W // 8)
|
670 |
|
|
|
743 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
744 |
"task": task_dic}
|
745 |
|
746 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
747 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
748 |
shape = (4, H // 8, W // 8)
|
749 |
|
|
|
803 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
804 |
"task": task_dic}
|
805 |
|
806 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
807 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
808 |
shape = (4, H // 8, W // 8)
|
809 |
|
|
|
861 |
cond = {"c_concat": [control],
|
862 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
863 |
"task": task_dic}
|
864 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
865 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
866 |
shape = (4, H // 8, W // 8)
|
867 |
|
|
|
918 |
cond = {"c_concat": [control],
|
919 |
"c_crossattn": [model.get_learned_conditioning([prompt + ', ' + a_prompt] * num_samples)],
|
920 |
"task": task_dic}
|
921 |
+
un_cond = {"c_concat": [control * 0] if guess_mode else [control],
|
922 |
"c_crossattn": [model.get_learned_conditioning([n_prompt] * num_samples)]}
|
923 |
shape = (4, H // 8, W // 8)
|
924 |
|
|
|
1310 |
strength, scale, seed, eta, condition_mode]
|
1311 |
run_button.click(fn=process_colorization, inputs=ips, outputs=[result_gallery])
|
1312 |
|
1313 |
+
with gr.TabItem("Deblurring"):
|
1314 |
with gr.Row():
|
1315 |
gr.Markdown("## UniControl Stable Diffusion with Image Deblurring")
|
1316 |
with gr.Row():
|