Update app.py
Browse files
app.py
CHANGED
@@ -121,7 +121,7 @@ run_mode = "mod_only"
|
|
121 |
store_attn_map = False
|
122 |
run_name = time.strftime("%m%d-%H%M")
|
123 |
|
124 |
-
num_inputs =
|
125 |
|
126 |
images = []
|
127 |
captions = []
|
@@ -209,8 +209,10 @@ def generate_image(
|
|
209 |
prompt,
|
210 |
image_1, caption_1,
|
211 |
image_2, caption_2,
|
|
|
212 |
use_id_1 = True,
|
213 |
use_id_2 = True,
|
|
|
214 |
cond_size = 256,
|
215 |
target_height = 768,
|
216 |
target_width = 768,
|
@@ -231,9 +233,9 @@ def generate_image(
|
|
231 |
torch.cuda.empty_cache()
|
232 |
num_images = 1
|
233 |
|
234 |
-
images = [image_1, image_2]
|
235 |
-
captions = [caption_1, caption_2]
|
236 |
-
idips_checkboxes = [use_id_1, use_id_2]
|
237 |
|
238 |
print(f"Length of images: {len(images)}")
|
239 |
print(f"Length of captions: {len(captions)}")
|
@@ -386,7 +388,7 @@ def create_image_input(index, open=True, indices_state=None):
|
|
386 |
|
387 |
def create_min_image_input(index, open=True, indices_state=None):
|
388 |
|
389 |
-
with gr.Column(min_width=
|
390 |
image = gr.Image(type="filepath", label=f"Image {index + 1}")
|
391 |
caption = gr.Textbox(label=f"ENT{index + 1} Prompt", value="")
|
392 |
|
@@ -483,7 +485,7 @@ def cleanup(request: gr.Request):
|
|
483 |
css = """
|
484 |
#col-container {
|
485 |
margin: 0 auto;
|
486 |
-
max-width:
|
487 |
}
|
488 |
"""
|
489 |
|
@@ -610,16 +612,19 @@ if __name__ == "__main__":
|
|
610 |
"ENT1 with long curly hair wearing ENT2 at Met Gala",
|
611 |
"sample/woman2.jpg", "a woman",
|
612 |
"sample/dress.jpg", "a dress",
|
|
|
613 |
],
|
614 |
[
|
615 |
"ENT1 wearing a tiny hat",
|
616 |
"sample/hamster.jpg", "a hamster",
|
617 |
None, None,
|
|
|
618 |
],
|
619 |
[
|
620 |
"ENT1 holding ENT2 in a park.",
|
621 |
"sample/woman.jpg", "a woman",
|
622 |
"sample/hamster.jpg", "a hamster",
|
|
|
623 |
],
|
624 |
],
|
625 |
inputs=[
|
@@ -640,8 +645,10 @@ if __name__ == "__main__":
|
|
640 |
prompt,
|
641 |
images[0], captions[0],
|
642 |
images[1], captions[1],
|
|
|
643 |
idip_checkboxes[0],
|
644 |
idip_checkboxes[1],
|
|
|
645 |
cond_size,
|
646 |
target_height,
|
647 |
target_width,
|
|
|
121 |
store_attn_map = False
|
122 |
run_name = time.strftime("%m%d-%H%M")
|
123 |
|
124 |
+
num_inputs = 3
|
125 |
|
126 |
images = []
|
127 |
captions = []
|
|
|
209 |
prompt,
|
210 |
image_1, caption_1,
|
211 |
image_2, caption_2,
|
212 |
+
image_3, caption_3,
|
213 |
use_id_1 = True,
|
214 |
use_id_2 = True,
|
215 |
+
use_id_3 = True,
|
216 |
cond_size = 256,
|
217 |
target_height = 768,
|
218 |
target_width = 768,
|
|
|
233 |
torch.cuda.empty_cache()
|
234 |
num_images = 1
|
235 |
|
236 |
+
images = [image_1, image_2, image_3]
|
237 |
+
captions = [caption_1, caption_2, caption_3]
|
238 |
+
idips_checkboxes = [use_id_1, use_id_2, use_id_3]
|
239 |
|
240 |
print(f"Length of images: {len(images)}")
|
241 |
print(f"Length of captions: {len(captions)}")
|
|
|
388 |
|
389 |
def create_min_image_input(index, open=True, indices_state=None):
|
390 |
|
391 |
+
with gr.Column(min_width=128):
|
392 |
image = gr.Image(type="filepath", label=f"Image {index + 1}")
|
393 |
caption = gr.Textbox(label=f"ENT{index + 1} Prompt", value="")
|
394 |
|
|
|
485 |
css = """
|
486 |
#col-container {
|
487 |
margin: 0 auto;
|
488 |
+
max-width: 1400px;
|
489 |
}
|
490 |
"""
|
491 |
|
|
|
612 |
"ENT1 with long curly hair wearing ENT2 at Met Gala",
|
613 |
"sample/woman2.jpg", "a woman",
|
614 |
"sample/dress.jpg", "a dress",
|
615 |
+
None, None,
|
616 |
],
|
617 |
[
|
618 |
"ENT1 wearing a tiny hat",
|
619 |
"sample/hamster.jpg", "a hamster",
|
620 |
None, None,
|
621 |
+
None, None,
|
622 |
],
|
623 |
[
|
624 |
"ENT1 holding ENT2 in a park.",
|
625 |
"sample/woman.jpg", "a woman",
|
626 |
"sample/hamster.jpg", "a hamster",
|
627 |
+
None, None,
|
628 |
],
|
629 |
],
|
630 |
inputs=[
|
|
|
645 |
prompt,
|
646 |
images[0], captions[0],
|
647 |
images[1], captions[1],
|
648 |
+
images[2], captions[2],
|
649 |
idip_checkboxes[0],
|
650 |
idip_checkboxes[1],
|
651 |
+
idip_checkboxes[2],
|
652 |
cond_size,
|
653 |
target_height,
|
654 |
target_width,
|