Spaces:
Runtime error
Runtime error
Linoy Tsaban
commited on
Commit
·
f54a73a
1
Parent(s):
b4d4a0c
Update app.py
Browse files
app.py
CHANGED
|
@@ -129,7 +129,7 @@ def invert_and_reconstruct(
|
|
| 129 |
|
| 130 |
|
| 131 |
x0 = load_512(input_image, device=device)
|
| 132 |
-
randomize_seed_fn(seed, randomize_seed)
|
| 133 |
|
| 134 |
if do_inversion:
|
| 135 |
# invert and retrieve noise maps and latent
|
|
@@ -140,7 +140,7 @@ def invert_and_reconstruct(
|
|
| 140 |
|
| 141 |
output = sample(zs.value, wts.value, prompt_tar=tar_prompt, skip=skip, cfg_scale_tar=tar_cfg_scale)
|
| 142 |
|
| 143 |
-
return output, wts, zs, do_inversion
|
| 144 |
|
| 145 |
|
| 146 |
|
|
@@ -231,7 +231,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 231 |
if randomize_seed:
|
| 232 |
seed = random.randint(0, np.iinfo(np.int32).max)
|
| 233 |
torch.manual_seed(seed)
|
| 234 |
-
|
| 235 |
|
| 236 |
gr.HTML(intro)
|
| 237 |
wts = gr.State()
|
|
@@ -289,7 +289,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 289 |
inputs=[input_image,
|
| 290 |
do_inversion,
|
| 291 |
wts, zs,
|
| 292 |
-
seed, randomize_seed
|
| 293 |
src_prompt,
|
| 294 |
tar_prompt,
|
| 295 |
steps,
|
|
@@ -297,7 +297,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
| 297 |
skip,
|
| 298 |
tar_cfg_scale,
|
| 299 |
],
|
| 300 |
-
outputs=[ddpm_edited_image, wts, zs, do_inversion],
|
| 301 |
)
|
| 302 |
|
| 303 |
edit_button.click(
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
x0 = load_512(input_image, device=device)
|
| 132 |
+
seed = randomize_seed_fn(seed, randomize_seed)
|
| 133 |
|
| 134 |
if do_inversion:
|
| 135 |
# invert and retrieve noise maps and latent
|
|
|
|
| 140 |
|
| 141 |
output = sample(zs.value, wts.value, prompt_tar=tar_prompt, skip=skip, cfg_scale_tar=tar_cfg_scale)
|
| 142 |
|
| 143 |
+
return output, wts, zs, do_inversion, seed
|
| 144 |
|
| 145 |
|
| 146 |
|
|
|
|
| 231 |
if randomize_seed:
|
| 232 |
seed = random.randint(0, np.iinfo(np.int32).max)
|
| 233 |
torch.manual_seed(seed)
|
| 234 |
+
return seed
|
| 235 |
|
| 236 |
gr.HTML(intro)
|
| 237 |
wts = gr.State()
|
|
|
|
| 289 |
inputs=[input_image,
|
| 290 |
do_inversion,
|
| 291 |
wts, zs,
|
| 292 |
+
seed, randomize_seed,
|
| 293 |
src_prompt,
|
| 294 |
tar_prompt,
|
| 295 |
steps,
|
|
|
|
| 297 |
skip,
|
| 298 |
tar_cfg_scale,
|
| 299 |
],
|
| 300 |
+
outputs=[ddpm_edited_image, wts, zs, do_inversion, seed],
|
| 301 |
)
|
| 302 |
|
| 303 |
edit_button.click(
|