Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
194b558
1
Parent(s):
fe793b9
Upload app.py
Browse files
app.py
CHANGED
@@ -179,9 +179,8 @@ def draw(input, grounding_texts, new_image_trigger, state):
|
|
179 |
return [box_image, new_image_trigger, image_scale, state]
|
180 |
|
181 |
|
182 |
-
def clear(
|
183 |
-
|
184 |
-
sketch_pad_trigger = sketch_pad_trigger + 1
|
185 |
blank_samples = batch_size % 2 if batch_size > 1 else 0
|
186 |
out_images = [None]
|
187 |
# state = {}
|
@@ -492,24 +491,28 @@ def main():
|
|
492 |
draw,
|
493 |
inputs=[sketch_pad, grounding_instruction, sketch_pad_resize_trigger, state],
|
494 |
outputs=[out_imagebox, sketch_pad_resize_trigger, image_scale, state],
|
|
|
495 |
queue=False,
|
496 |
)
|
497 |
grounding_instruction.change(
|
498 |
draw,
|
499 |
inputs=[sketch_pad, grounding_instruction, sketch_pad_resize_trigger, state],
|
500 |
outputs=[out_imagebox, sketch_pad_resize_trigger, image_scale, state],
|
|
|
501 |
queue=False,
|
502 |
)
|
503 |
clear_btn.click(
|
504 |
clear,
|
505 |
inputs=[sketch_pad_trigger, sketch_pad_trigger, batch_size, state],
|
506 |
outputs=[sketch_pad, sketch_pad_trigger, out_imagebox, image_scale, out_gen_1, state],
|
|
|
507 |
queue=False)
|
508 |
|
509 |
sketch_pad_trigger.change(
|
510 |
controller.init_white,
|
511 |
inputs=[init_white_trigger],
|
512 |
outputs=[sketch_pad, image_scale, init_white_trigger],
|
|
|
513 |
queue=False)
|
514 |
|
515 |
gen_btn.click(
|
@@ -522,6 +525,7 @@ def main():
|
|
522 |
state,
|
523 |
],
|
524 |
outputs=[out_gen_1, state],
|
|
|
525 |
queue=True
|
526 |
)
|
527 |
sketch_pad_resize_trigger.change(
|
@@ -529,12 +533,14 @@ def main():
|
|
529 |
None,
|
530 |
sketch_pad_resize_trigger,
|
531 |
js=rescale_js,
|
|
|
532 |
queue=False)
|
533 |
init_white_trigger.change(
|
534 |
None,
|
535 |
None,
|
536 |
init_white_trigger,
|
537 |
js=rescale_js,
|
|
|
538 |
queue=False)
|
539 |
|
540 |
with gr.Column():
|
|
|
179 |
return [box_image, new_image_trigger, image_scale, state]
|
180 |
|
181 |
|
182 |
+
def clear(sketch_pad_trigger, batch_size, state, switch_task=False):
|
183 |
+
sketch_pad_trigger = sketch_pad_trigger + 1
|
|
|
184 |
blank_samples = batch_size % 2 if batch_size > 1 else 0
|
185 |
out_images = [None]
|
186 |
# state = {}
|
|
|
491 |
draw,
|
492 |
inputs=[sketch_pad, grounding_instruction, sketch_pad_resize_trigger, state],
|
493 |
outputs=[out_imagebox, sketch_pad_resize_trigger, image_scale, state],
|
494 |
+
concurrency_limit=1,
|
495 |
queue=False,
|
496 |
)
|
497 |
grounding_instruction.change(
|
498 |
draw,
|
499 |
inputs=[sketch_pad, grounding_instruction, sketch_pad_resize_trigger, state],
|
500 |
outputs=[out_imagebox, sketch_pad_resize_trigger, image_scale, state],
|
501 |
+
concurrency_limit=1,
|
502 |
queue=False,
|
503 |
)
|
504 |
clear_btn.click(
|
505 |
clear,
|
506 |
inputs=[sketch_pad_trigger, sketch_pad_trigger, batch_size, state],
|
507 |
outputs=[sketch_pad, sketch_pad_trigger, out_imagebox, image_scale, out_gen_1, state],
|
508 |
+
concurrency_limit=1,
|
509 |
queue=False)
|
510 |
|
511 |
sketch_pad_trigger.change(
|
512 |
controller.init_white,
|
513 |
inputs=[init_white_trigger],
|
514 |
outputs=[sketch_pad, image_scale, init_white_trigger],
|
515 |
+
concurrency_limit=1,
|
516 |
queue=False)
|
517 |
|
518 |
gen_btn.click(
|
|
|
525 |
state,
|
526 |
],
|
527 |
outputs=[out_gen_1, state],
|
528 |
+
concurrency_limit=1,
|
529 |
queue=True
|
530 |
)
|
531 |
sketch_pad_resize_trigger.change(
|
|
|
533 |
None,
|
534 |
sketch_pad_resize_trigger,
|
535 |
js=rescale_js,
|
536 |
+
concurrency_limit=1,
|
537 |
queue=False)
|
538 |
init_white_trigger.change(
|
539 |
None,
|
540 |
None,
|
541 |
init_white_trigger,
|
542 |
js=rescale_js,
|
543 |
+
concurrency_limit=1,
|
544 |
queue=False)
|
545 |
|
546 |
with gr.Column():
|