Spaces:
Running
on
Zero
Running
on
Zero
Upload app.py
Browse files
app.py
CHANGED
|
@@ -443,10 +443,12 @@ def update_all_points(visible_points, occlusion_points):
|
|
| 443 |
# 返回更新字典来明确设置 choices 和 value
|
| 444 |
return text, gr.Dropdown(label="Select Visible Point to Delete", choices=visible_dropdown_choices, value=None, interactive=True), gr.Dropdown(label="Select Occlusion Point to Delete", choices=occlusion_dropdown_choices, value=None, interactive=True)
|
| 445 |
|
| 446 |
-
def delete_selected_visible(image, visible_points, occlusion_points,
|
| 447 |
-
""
|
| 448 |
-
|
| 449 |
-
|
|
|
|
|
|
|
| 450 |
if selected_index is not None and 0 <= selected_index < len(visible_points):
|
| 451 |
visible_points.pop(selected_index)
|
| 452 |
updated_image = image.copy()
|
|
@@ -456,10 +458,11 @@ def delete_selected_visible(image, visible_points, occlusion_points, selected_in
|
|
| 456 |
updated_text, vis_dropdown, occ_dropdown = update_all_points(visible_points, occlusion_points)
|
| 457 |
return updated_image, visible_points, occlusion_points, updated_text, vis_dropdown, occ_dropdown
|
| 458 |
|
| 459 |
-
def delete_selected_occlusion(image, visible_points, occlusion_points,
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
|
|
|
| 463 |
if selected_index is not None and 0 <= selected_index < len(occlusion_points):
|
| 464 |
occlusion_points.pop(selected_index)
|
| 465 |
updated_image = image.copy()
|
|
|
|
| 443 |
# 返回更新字典来明确设置 choices 和 value
|
| 444 |
return text, gr.Dropdown(label="Select Visible Point to Delete", choices=visible_dropdown_choices, value=None, interactive=True), gr.Dropdown(label="Select Occlusion Point to Delete", choices=occlusion_dropdown_choices, value=None, interactive=True)
|
| 445 |
|
| 446 |
+
def delete_selected_visible(image, visible_points, occlusion_points, selected_value):
|
| 447 |
+
# selected_value 是类似 "(x, y)" 的字符串
|
| 448 |
+
try:
|
| 449 |
+
selected_index = [f"({p[0]}, {p[1]})" for p in visible_points].index(selected_value)
|
| 450 |
+
except ValueError:
|
| 451 |
+
selected_index = None
|
| 452 |
if selected_index is not None and 0 <= selected_index < len(visible_points):
|
| 453 |
visible_points.pop(selected_index)
|
| 454 |
updated_image = image.copy()
|
|
|
|
| 458 |
updated_text, vis_dropdown, occ_dropdown = update_all_points(visible_points, occlusion_points)
|
| 459 |
return updated_image, visible_points, occlusion_points, updated_text, vis_dropdown, occ_dropdown
|
| 460 |
|
| 461 |
+
def delete_selected_occlusion(image, visible_points, occlusion_points, selected_value):
|
| 462 |
+
try:
|
| 463 |
+
selected_index = [f"({p[0]}, {p[1]})" for p in occlusion_points].index(selected_value)
|
| 464 |
+
except ValueError:
|
| 465 |
+
selected_index = None
|
| 466 |
if selected_index is not None and 0 <= selected_index < len(occlusion_points):
|
| 467 |
occlusion_points.pop(selected_index)
|
| 468 |
updated_image = image.copy()
|