Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,24 +54,21 @@ def invert_and_edit(image,
|
|
| 54 |
if randomize_seed:
|
| 55 |
seed = random.randint(0, MAX_SEED)
|
| 56 |
if do_inversion:
|
| 57 |
-
|
| 58 |
-
inverted_latents = gr.State(value=inverted_latents_tensor)
|
| 59 |
-
image_latents = gr.State(value=image_latents_tensor)
|
| 60 |
-
latent_image_ids = gr.State(value=latent_image_ids_tensor)
|
| 61 |
do_inversion = False
|
| 62 |
|
| 63 |
|
| 64 |
output = pipe(prompt,
|
| 65 |
-
inverted_latents=inverted_latents
|
| 66 |
-
image_latents=image_latents
|
| 67 |
-
latent_image_ids=latent_image_ids
|
| 68 |
start_timestep=start_timestep,
|
| 69 |
stop_timestep=stop_timestep,
|
| 70 |
num_inference_steps=num_inversion_steps,
|
| 71 |
eta=eta,
|
| 72 |
).images[0]
|
| 73 |
|
| 74 |
-
return output, inverted_latents
|
| 75 |
|
| 76 |
# UI CSS
|
| 77 |
css = """
|
|
|
|
| 54 |
if randomize_seed:
|
| 55 |
seed = random.randint(0, MAX_SEED)
|
| 56 |
if do_inversion:
|
| 57 |
+
inverted_latents, image_latents, latent_image_ids = pipe.invert(image, num_inversion_steps=num_inversion_steps, gamma=gamma)
|
|
|
|
|
|
|
|
|
|
| 58 |
do_inversion = False
|
| 59 |
|
| 60 |
|
| 61 |
output = pipe(prompt,
|
| 62 |
+
inverted_latents=inverted_latents,
|
| 63 |
+
image_latents=image_latents,
|
| 64 |
+
latent_image_ids=latent_image_ids,
|
| 65 |
start_timestep=start_timestep,
|
| 66 |
stop_timestep=stop_timestep,
|
| 67 |
num_inference_steps=num_inversion_steps,
|
| 68 |
eta=eta,
|
| 69 |
).images[0]
|
| 70 |
|
| 71 |
+
return output, inverted_latents, image_latents, latent_image_ids, do_inversion, seed
|
| 72 |
|
| 73 |
# UI CSS
|
| 74 |
css = """
|