helloworld-S commited on
Commit
71d9441
·
verified ·
1 Parent(s): df618a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -137,7 +137,8 @@ accordion_states = []
137
 
138
  def open_accordion_on_example_selection(*args):
139
  print("enter open_accordion_on_example_selection")
140
- images = list(args[:num_inputs])
 
141
  outputs = []
142
  for i, img in enumerate(images):
143
  if img is not None:
@@ -513,9 +514,9 @@ if __name__ == "__main__":
513
  examples = gr.Examples(
514
  examples=[
515
  [
516
- "sample/hamster.jpg", None, None, None,
517
- "a hamster", None, None, None,
518
- False, False, False, False,
519
  "ENT1 wearing a tiny hat",
520
  42, 256, 768, 768,
521
  3, 5,
@@ -523,9 +524,9 @@ if __name__ == "__main__":
523
  0.05, 0.8,
524
  ],
525
  [
526
- "sample/woman.jpg", None, None, None,
527
- "a woman", None, None, None,
528
- True, False, False, False,
529
  "ENT1 in a red dress is smiling",
530
  42, 256, 768, 768,
531
  3, 5,
@@ -533,9 +534,9 @@ if __name__ == "__main__":
533
  0.05, 0.8,
534
  ],
535
  [
536
- "sample/woman.jpg", "sample/girl.jpg", None, None,
537
- "a woman", "a girl", None, None,
538
- True, True, False, False,
539
  "ENT1 and ENT2 standing together in a park.",
540
  42, 256, 768, 768,
541
  2, 5,
@@ -543,9 +544,9 @@ if __name__ == "__main__":
543
  0.05, 0.8,
544
  ],
545
  [
546
- "sample/woman.jpg", "sample/girl.jpg", "sample/old_man.jpg", None,
547
- "a woman", "a girl", "an old man", None,
548
- True, True, True, False,
549
  "ENT1, ENT2, and ENT3 standing together in a park.",
550
  42, 256, 768, 768,
551
  2.5, 5,
@@ -554,9 +555,9 @@ if __name__ == "__main__":
554
  ],
555
  ],
556
  inputs=[
557
- images[0], images[1], images[2], images[3],
558
- captions[0], captions[1], captions[2], captions[3],
559
- idip_checkboxes[0], idip_checkboxes[1], idip_checkboxes[2], idip_checkboxes[3],
560
  prompt, seed,
561
  cond_size,
562
  target_height,
 
137
 
138
  def open_accordion_on_example_selection(*args):
139
  print("enter open_accordion_on_example_selection")
140
+ len_images = (len(args)-11)//3
141
+ images = list(args[:len_images])+[None,]*(num_inputs-len_images)
142
  outputs = []
143
  for i, img in enumerate(images):
144
  if img is not None:
 
514
  examples = gr.Examples(
515
  examples=[
516
  [
517
+ "sample/hamster.jpg", None, None,
518
+ "a hamster", None, None,
519
+ False, False, False,
520
  "ENT1 wearing a tiny hat",
521
  42, 256, 768, 768,
522
  3, 5,
 
524
  0.05, 0.8,
525
  ],
526
  [
527
+ "sample/woman.jpg", None, None,
528
+ "a woman", None, None,
529
+ True, False, False,
530
  "ENT1 in a red dress is smiling",
531
  42, 256, 768, 768,
532
  3, 5,
 
534
  0.05, 0.8,
535
  ],
536
  [
537
+ "sample/woman.jpg", "sample/girl.jpg", None,
538
+ "a woman", "a girl", None,
539
+ True, True, False,
540
  "ENT1 and ENT2 standing together in a park.",
541
  42, 256, 768, 768,
542
  2, 5,
 
544
  0.05, 0.8,
545
  ],
546
  [
547
+ "sample/woman.jpg", "sample/girl.jpg", "sample/old_man.jpg",
548
+ "a woman", "a girl", "an old man",
549
+ True, True, True,
550
  "ENT1, ENT2, and ENT3 standing together in a park.",
551
  42, 256, 768, 768,
552
  2.5, 5,
 
555
  ],
556
  ],
557
  inputs=[
558
+ images[0], images[1], images[2],
559
+ captions[0], captions[1], captions[2],
560
+ idip_checkboxes[0], idip_checkboxes[1], idip_checkboxes[2],
561
  prompt, seed,
562
  cond_size,
563
  target_height,