alexnasa commited on
Commit
4da972c
·
verified ·
1 Parent(s): 67059c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -208,9 +208,7 @@ def resize_keep_aspect_ratio(pil_image, target_size=1024):
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,9 +229,18 @@ 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)}")
@@ -640,8 +647,6 @@ 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,
 
208
  def generate_image(
209
  prompt,
210
  image_1, caption_1,
211
+ image_2 = None, caption_2 = None,
 
 
212
  cond_size = 256,
213
  target_height = 768,
214
  target_width = 768,
 
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
+ else 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
  prompt,
648
  images[0], captions[0],
649
  images[1], captions[1],
 
 
650
  cond_size,
651
  target_height,
652
  target_width,