Spaces:
Running
on
A10G
Running
on
A10G
Linoy Tsaban
commited on
Commit
•
7c80d27
1
Parent(s):
7b74d32
Update app.py
Browse files
app.py
CHANGED
@@ -216,8 +216,9 @@ def edit(input_image,
|
|
216 |
return reconstruction.value, reconstruct_button.update(visible=False), do_reconstruction, reconstruction, wts, zs, do_inversion, show_share_button
|
217 |
|
218 |
|
219 |
-
def randomize_seed_fn():
|
220 |
-
|
|
|
221 |
return seed
|
222 |
|
223 |
def seed_everything(seed):
|
@@ -708,7 +709,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
708 |
outputs = [do_inversion],
|
709 |
queue = False).then(
|
710 |
fn = randomize_seed_fn,
|
711 |
-
|
712 |
outputs = [seed], queue = False)
|
713 |
# Automatically start inverting upon input_image change
|
714 |
input_image.upload(fn = crop_image, inputs = [input_image], outputs = [input_image],queue=False).then(
|
@@ -716,7 +717,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
716 |
outputs = [do_inversion],
|
717 |
queue = False).then(
|
718 |
fn = randomize_seed_fn,
|
719 |
-
|
720 |
outputs = [seed], queue = False).then(fn = caption_image,
|
721 |
inputs = [input_image],
|
722 |
outputs = [tar_prompt, image_caption]).then(fn = update_inversion_progress_visibility, inputs =[input_image,do_inversion],
|
@@ -820,7 +821,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
820 |
|
821 |
randomize_seed.change(
|
822 |
fn = randomize_seed_fn,
|
823 |
-
|
824 |
outputs = [seed],
|
825 |
queue = False)
|
826 |
|
|
|
216 |
return reconstruction.value, reconstruct_button.update(visible=False), do_reconstruction, reconstruction, wts, zs, do_inversion, show_share_button
|
217 |
|
218 |
|
219 |
+
def randomize_seed_fn(seed, is_random):
|
220 |
+
if is_random:
|
221 |
+
seed = random.randint(0, np.iinfo(np.int32).max)
|
222 |
return seed
|
223 |
|
224 |
def seed_everything(seed):
|
|
|
709 |
outputs = [do_inversion],
|
710 |
queue = False).then(
|
711 |
fn = randomize_seed_fn,
|
712 |
+
inputs = [seed, randomize_seed],
|
713 |
outputs = [seed], queue = False)
|
714 |
# Automatically start inverting upon input_image change
|
715 |
input_image.upload(fn = crop_image, inputs = [input_image], outputs = [input_image],queue=False).then(
|
|
|
717 |
outputs = [do_inversion],
|
718 |
queue = False).then(
|
719 |
fn = randomize_seed_fn,
|
720 |
+
inputs = [seed, randomize_seed],
|
721 |
outputs = [seed], queue = False).then(fn = caption_image,
|
722 |
inputs = [input_image],
|
723 |
outputs = [tar_prompt, image_caption]).then(fn = update_inversion_progress_visibility, inputs =[input_image,do_inversion],
|
|
|
821 |
|
822 |
randomize_seed.change(
|
823 |
fn = randomize_seed_fn,
|
824 |
+
inputs = [seed, randomize_seed],
|
825 |
outputs = [seed],
|
826 |
queue = False)
|
827 |
|