Pusheen commited on
Commit
3bb012e
1 Parent(s): 15f405c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -329,9 +329,10 @@ Please draw boxes accordingly on the sketch pad.""".format(len(boxes), len(groun
329
  fix_seed, rand_seed, actual_mask, style_cond_image, clip_model=clip_model,
330
  )
331
  blank_samples = batch_size % 2 if batch_size > 1 else 0
332
- gen_images = [gr.Image.update(value=x, visible=True) for i,x in enumerate(gen_images)] \
333
- + [gr.Image.update(value=None, visible=True) for _ in range(blank_samples)] \
334
- + [gr.Image.update(value=None, visible=False) for _ in range(4 - batch_size - blank_samples)]
 
335
 
336
  return gen_images + [state]
337
 
@@ -507,9 +508,10 @@ def clear(task, sketch_pad_trigger, batch_size, state,trigger_stage, switch_task
507
  sketch_pad_trigger = sketch_pad_trigger + 1
508
  trigger_stage = 0
509
  blank_samples = batch_size % 2 if batch_size > 1 else 0
510
- out_images = [gr.Image.update(value=None, visible=True) for i in range(batch_size)] \
511
- + [gr.Image.update(value=None, visible=True) for _ in range(blank_samples)] \
512
- + [gr.Image.update(value=None, visible=False) for _ in range(4 - batch_size - blank_samples)]
 
513
  state = {}
514
  return [None, sketch_pad_trigger, None, 1.0] + out_images + [state] + [trigger_stage]
515
 
@@ -676,7 +678,7 @@ with Blocks(
676
  clear_btn.click(
677
  clear,
678
  inputs=[task, sketch_pad_trigger, batch_size,trigger_stage, state],
679
- outputs=[sketch_pad, sketch_pad_trigger, out_imagebox, image_scale, out_gen_1, out_gen_2, out_gen_3, out_gen_4, state, trigger_stage],
680
  queue=False)
681
 
682
  sketch_pad_trigger.change(
@@ -695,7 +697,7 @@ with Blocks(
695
  append_grounding, style_cond_image,
696
  state,
697
  ],
698
- outputs=[out_gen_1, out_gen_2, out_gen_3, out_gen_4, state],
699
  queue=True
700
  )
701
  init_white_trigger.change(
 
329
  fix_seed, rand_seed, actual_mask, style_cond_image, clip_model=clip_model,
330
  )
331
  blank_samples = batch_size % 2 if batch_size > 1 else 0
332
+ gen_images = [gr.Image.update(value=x, visible=True) for i,x in enumerate(gen_images)]
333
+ # \
334
+ # + [gr.Image.update(value=None, visible=True) for _ in range(blank_samples)] \
335
+ # + [gr.Image.update(value=None, visible=False) for _ in range(4 - batch_size - blank_samples)]
336
 
337
  return gen_images + [state]
338
 
 
508
  sketch_pad_trigger = sketch_pad_trigger + 1
509
  trigger_stage = 0
510
  blank_samples = batch_size % 2 if batch_size > 1 else 0
511
+ out_images = [gr.Image.update(value=None, visible=True) for i in range(batch_size)]
512
+ # \
513
+ # + [gr.Image.update(value=None, visible=True) for _ in range(blank_samples)] \
514
+ # + [gr.Image.update(value=None, visible=False) for _ in range(4 - batch_size - blank_samples)]
515
  state = {}
516
  return [None, sketch_pad_trigger, None, 1.0] + out_images + [state] + [trigger_stage]
517
 
 
678
  clear_btn.click(
679
  clear,
680
  inputs=[task, sketch_pad_trigger, batch_size,trigger_stage, state],
681
+ outputs=[sketch_pad, sketch_pad_trigger, out_imagebox, image_scale, out_gen_1, state, trigger_stage],
682
  queue=False)
683
 
684
  sketch_pad_trigger.change(
 
697
  append_grounding, style_cond_image,
698
  state,
699
  ],
700
+ outputs=[out_gen_1, state],
701
  queue=True
702
  )
703
  init_white_trigger.change(