Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -165,9 +165,10 @@ def inpaint(image, width, height, overlap_percentage, num_inference_steps, resiz
|
|
165 |
|
166 |
# blend foreground with background and alpha, less color bleeding
|
167 |
#new_image = blend(foreground, np.array(background), alpha)
|
|
|
168 |
cnet_image.paste(result, (0, 0), mask)
|
169 |
|
170 |
-
return cnet_image, background, mask
|
171 |
|
172 |
def preview_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):
|
173 |
background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)
|
@@ -311,6 +312,18 @@ with gr.Blocks(css=css) as demo:
|
|
311 |
interactive=False,
|
312 |
label="Generated Mask",
|
313 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
use_as_input_button = gr.Button("Use as Input Image", visible=False)
|
315 |
with gr.Accordion("History and Mask", open=False):
|
316 |
history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)
|
@@ -362,7 +375,7 @@ with gr.Blocks(css=css) as demo:
|
|
362 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
363 |
resize_option, custom_resize_percentage, prompt_input, alignment_dropdown,
|
364 |
overlap_left, overlap_right, overlap_top, overlap_bottom],
|
365 |
-
outputs=[result, preview_image, result_mask],
|
366 |
).then(
|
367 |
fn=lambda x, history: update_history(x, history),
|
368 |
inputs=[result, history_gallery],
|
|
|
165 |
|
166 |
# blend foreground with background and alpha, less color bleeding
|
167 |
#new_image = blend(foreground, np.array(background), alpha)
|
168 |
+
cnet_pure = cnet_image
|
169 |
cnet_image.paste(result, (0, 0), mask)
|
170 |
|
171 |
+
return cnet_image, background, mask, result, cnet_pure, background
|
172 |
|
173 |
def preview_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom):
|
174 |
background, mask = prepare_image_and_mask(image, width, height, overlap_percentage, resize_option, custom_resize_percentage, alignment, overlap_left, overlap_right, overlap_top, overlap_bottom)
|
|
|
312 |
interactive=False,
|
313 |
label="Generated Mask",
|
314 |
)
|
315 |
+
result_pure = gr.Image(
|
316 |
+
interactive=False,
|
317 |
+
label="Generated Result",
|
318 |
+
)
|
319 |
+
cnet_pure = gr.Image(
|
320 |
+
interactive=False,
|
321 |
+
label="Cnet Pure",
|
322 |
+
)
|
323 |
+
background = gr.Image(
|
324 |
+
interactive=False,
|
325 |
+
label="background",
|
326 |
+
)
|
327 |
use_as_input_button = gr.Button("Use as Input Image", visible=False)
|
328 |
with gr.Accordion("History and Mask", open=False):
|
329 |
history_gallery = gr.Gallery(label="History", columns=6, object_fit="contain", interactive=False)
|
|
|
375 |
inputs=[input_image, width_slider, height_slider, overlap_percentage, num_inference_steps,
|
376 |
resize_option, custom_resize_percentage, prompt_input, alignment_dropdown,
|
377 |
overlap_left, overlap_right, overlap_top, overlap_bottom],
|
378 |
+
outputs=[result, preview_image, result_mask, result_pure, cnet_pure, background],
|
379 |
).then(
|
380 |
fn=lambda x, history: update_history(x, history),
|
381 |
inputs=[result, history_gallery],
|