Update app.py
Browse files
app.py
CHANGED
@@ -208,7 +208,9 @@ def resize_keep_aspect_ratio(pil_image, target_size=1024):
|
|
208 |
def generate_image(
|
209 |
prompt,
|
210 |
image_1, caption_1,
|
211 |
-
image_2
|
|
|
|
|
212 |
cond_size = 256,
|
213 |
target_height = 768,
|
214 |
target_width = 768,
|
@@ -229,18 +231,9 @@ def generate_image(
|
|
229 |
torch.cuda.empty_cache()
|
230 |
num_images = 1
|
231 |
|
232 |
-
images = []
|
233 |
-
captions = []
|
234 |
-
idips_checkboxes = []
|
235 |
-
|
236 |
-
if image_1 != None:
|
237 |
-
images.append(image_1)
|
238 |
-
captions.append(caption_1)
|
239 |
-
idips_checkboxes.append(True)
|
240 |
-
elif image_2 != None:
|
241 |
-
images.append(image_2)
|
242 |
-
captions.append(caption_2)
|
243 |
-
idips_checkboxes.append(True)
|
244 |
|
245 |
print(f"Length of images: {len(images)}")
|
246 |
print(f"Length of captions: {len(captions)}")
|
@@ -647,6 +640,8 @@ if __name__ == "__main__":
|
|
647 |
prompt,
|
648 |
images[0], captions[0],
|
649 |
images[1], captions[1],
|
|
|
|
|
650 |
cond_size,
|
651 |
target_height,
|
652 |
target_width,
|
|
|
208 |
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 |
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)}")
|
|
|
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,
|