Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -196,7 +196,7 @@ def edit_inference(input_image, prompt, negative_prompt, guidance_scale, ddim_st
|
|
196 |
network.proj = torch.nn.Parameter(original_weights)
|
197 |
network.reset()
|
198 |
|
199 |
-
return (image, input_image[
|
200 |
|
201 |
|
202 |
def sample_then_run():
|
@@ -344,10 +344,11 @@ def invert(image, mask, pcs=10000, epochs=400, weight_decay = 1e-10, lr=1e-1):
|
|
344 |
|
345 |
|
346 |
|
347 |
-
def run_inversion(
|
348 |
global network
|
349 |
-
|
350 |
-
|
|
|
351 |
network = invert([init_image], mask, pcs, epochs, weight_decay,lr)
|
352 |
|
353 |
|
@@ -516,7 +517,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
516 |
|
517 |
invert_button.click(fn=run_inversion,
|
518 |
inputs=[input_image, pcs, epochs, weight_decay,lr],
|
519 |
-
outputs = [
|
520 |
|
521 |
|
522 |
sample.click(fn=sample_then_run, outputs=[input_image, file_output])
|
|
|
196 |
network.proj = torch.nn.Parameter(original_weights)
|
197 |
network.reset()
|
198 |
|
199 |
+
return (image, input_image["background"])
|
200 |
|
201 |
|
202 |
def sample_then_run():
|
|
|
344 |
|
345 |
|
346 |
|
347 |
+
def run_inversion(input_image, pcs, epochs, weight_decay,lr):
|
348 |
global network
|
349 |
+
print(len(input_image["layers"]))
|
350 |
+
init_image = input_image["background"].convert("RGB").resize((512, 512))
|
351 |
+
mask = input_image["layers"][0].convert("RGB").resize((512, 512))
|
352 |
network = invert([init_image], mask, pcs, epochs, weight_decay,lr)
|
353 |
|
354 |
|
|
|
517 |
|
518 |
invert_button.click(fn=run_inversion,
|
519 |
inputs=[input_image, pcs, epochs, weight_decay,lr],
|
520 |
+
outputs = [image_slider, file_output])
|
521 |
|
522 |
|
523 |
sample.click(fn=sample_then_run, outputs=[input_image, file_output])
|