Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -342,31 +342,21 @@ def merge_instances(orig_img, indices, ins_bboxes, ins_images):
|
|
342 |
img = final_img.crop(bbox)
|
343 |
return img, bbox
|
344 |
|
345 |
-
|
346 |
-
|
347 |
-
#
|
348 |
-
#
|
349 |
-
#
|
350 |
-
|
351 |
-
#
|
352 |
-
#
|
353 |
-
#
|
354 |
-
|
355 |
-
def change_accordion(at: bool, index: int, state: list):
|
356 |
-
print("change_accordion", index, state)
|
357 |
-
print("at:", at)
|
358 |
-
indexs = state
|
359 |
-
if at:
|
360 |
-
if index not in indexs:
|
361 |
-
indexs.append(index)
|
362 |
-
else:
|
363 |
-
if index in indexs:
|
364 |
-
indexs.remove(index)
|
365 |
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
|
371 |
def update_inputs(is_open, index, state: list):
|
372 |
indexs = state
|
@@ -519,7 +509,7 @@ if __name__ == "__main__":
|
|
519 |
face_btns[i].click(crop_face_img, inputs=[images[i]], outputs=[images[i]])
|
520 |
det_btns[i].click(det_seg_img, inputs=[images[i], captions[i]], outputs=[images[i]])
|
521 |
vlm_btns[i].click(vlm_img_caption, inputs=[images[i]], outputs=[captions[i]])
|
522 |
-
accordion_states[i].change(fn=lambda x, state, index=i: change_accordion(x, index, state), inputs=[accordion_states[i], indexs_state], outputs=[accordions[i], indexs_state])
|
523 |
|
524 |
|
525 |
examples = gr.Examples(
|
|
|
342 |
img = final_img.crop(bbox)
|
343 |
return img, bbox
|
344 |
|
345 |
+
# def change_accordion(at: bool, index: int, state: list):
|
346 |
+
# print("change_accordion", index, state)
|
347 |
+
# print("at:", at)
|
348 |
+
# indexs = state
|
349 |
+
# if at:
|
350 |
+
# if index not in indexs:
|
351 |
+
# indexs.append(index)
|
352 |
+
# else:
|
353 |
+
# if index in indexs:
|
354 |
+
# indexs.remove(index)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
+
# # 确保 indexs 是有序的
|
357 |
+
# indexs.sort()
|
358 |
+
# print("After changed", indexs)
|
359 |
+
# return gr.Accordion(open=at), indexs
|
360 |
|
361 |
def update_inputs(is_open, index, state: list):
|
362 |
indexs = state
|
|
|
509 |
face_btns[i].click(crop_face_img, inputs=[images[i]], outputs=[images[i]])
|
510 |
det_btns[i].click(det_seg_img, inputs=[images[i], captions[i]], outputs=[images[i]])
|
511 |
vlm_btns[i].click(vlm_img_caption, inputs=[images[i]], outputs=[captions[i]])
|
512 |
+
# accordion_states[i].change(fn=lambda x, state, index=i: change_accordion(x, index, state), inputs=[accordion_states[i], indexs_state], outputs=[accordions[i], indexs_state])
|
513 |
|
514 |
|
515 |
examples = gr.Examples(
|