Spaces:
Build error
Build error
Commit
·
900181c
1
Parent(s):
f69b2cb
fix example images
Browse files
app.py
CHANGED
|
@@ -904,16 +904,20 @@ def update_task_ui(task):
|
|
| 904 |
|
| 905 |
def update_image_preview(image_file):
|
| 906 |
"""Update the image preview."""
|
| 907 |
-
if image_file:
|
| 908 |
-
return
|
| 909 |
-
|
|
|
|
|
|
|
| 910 |
|
| 911 |
|
| 912 |
def update_goal_preview(goal_file):
|
| 913 |
"""Update the goal preview."""
|
| 914 |
-
if goal_file:
|
| 915 |
-
return
|
| 916 |
-
|
|
|
|
|
|
|
| 917 |
|
| 918 |
|
| 919 |
def get_download_link(selected_frame, all_paths):
|
|
@@ -1419,10 +1423,9 @@ with gr.Blocks(
|
|
| 1419 |
)
|
| 1420 |
|
| 1421 |
with gr.Group(visible=False) as prediction_group:
|
| 1422 |
-
image_input = gr.
|
| 1423 |
label="Upload Start Image",
|
| 1424 |
-
|
| 1425 |
-
file_types=["image"],
|
| 1426 |
interactive=True,
|
| 1427 |
elem_id="image_input",
|
| 1428 |
)
|
|
@@ -1440,17 +1443,15 @@ with gr.Blocks(
|
|
| 1440 |
|
| 1441 |
with gr.Group(visible=False) as planning_group:
|
| 1442 |
with gr.Row():
|
| 1443 |
-
image_input_planning = gr.
|
| 1444 |
label="Upload Start Image",
|
| 1445 |
-
|
| 1446 |
-
file_types=["image"],
|
| 1447 |
interactive=True,
|
| 1448 |
elem_id="image_input_planning",
|
| 1449 |
)
|
| 1450 |
-
goal_input = gr.
|
| 1451 |
label="Upload Goal Image",
|
| 1452 |
-
|
| 1453 |
-
file_types=["image"],
|
| 1454 |
interactive=True,
|
| 1455 |
elem_id="goal_input",
|
| 1456 |
)
|
|
@@ -1704,11 +1705,15 @@ with gr.Blocks(
|
|
| 1704 |
)
|
| 1705 |
|
| 1706 |
image_input.change(
|
| 1707 |
-
fn=update_image_preview,
|
|
|
|
|
|
|
| 1708 |
).then(fn=lambda: gr.update(visible=True), inputs=[], outputs=[preview_row])
|
| 1709 |
|
| 1710 |
goal_input.change(
|
| 1711 |
-
fn=update_goal_preview,
|
|
|
|
|
|
|
| 1712 |
).then(fn=lambda: gr.update(visible=True), inputs=[], outputs=[preview_row])
|
| 1713 |
|
| 1714 |
def update_pointcloud_frames(pointcloud_paths):
|
|
|
|
| 904 |
|
| 905 |
def update_image_preview(image_file):
|
| 906 |
"""Update the image preview."""
|
| 907 |
+
if image_file is None:
|
| 908 |
+
return None
|
| 909 |
+
if isinstance(image_file, str):
|
| 910 |
+
return image_file
|
| 911 |
+
return image_file.name if hasattr(image_file, 'name') else None
|
| 912 |
|
| 913 |
|
| 914 |
def update_goal_preview(goal_file):
|
| 915 |
"""Update the goal preview."""
|
| 916 |
+
if goal_file is None:
|
| 917 |
+
return None
|
| 918 |
+
if isinstance(goal_file, str):
|
| 919 |
+
return goal_file
|
| 920 |
+
return goal_file.name if hasattr(goal_file, 'name') else None
|
| 921 |
|
| 922 |
|
| 923 |
def get_download_link(selected_frame, all_paths):
|
|
|
|
| 1423 |
)
|
| 1424 |
|
| 1425 |
with gr.Group(visible=False) as prediction_group:
|
| 1426 |
+
image_input = gr.Image(
|
| 1427 |
label="Upload Start Image",
|
| 1428 |
+
type="filepath",
|
|
|
|
| 1429 |
interactive=True,
|
| 1430 |
elem_id="image_input",
|
| 1431 |
)
|
|
|
|
| 1443 |
|
| 1444 |
with gr.Group(visible=False) as planning_group:
|
| 1445 |
with gr.Row():
|
| 1446 |
+
image_input_planning = gr.Image(
|
| 1447 |
label="Upload Start Image",
|
| 1448 |
+
type="filepath",
|
|
|
|
| 1449 |
interactive=True,
|
| 1450 |
elem_id="image_input_planning",
|
| 1451 |
)
|
| 1452 |
+
goal_input = gr.Image(
|
| 1453 |
label="Upload Goal Image",
|
| 1454 |
+
type="filepath",
|
|
|
|
| 1455 |
interactive=True,
|
| 1456 |
elem_id="goal_input",
|
| 1457 |
)
|
|
|
|
| 1705 |
)
|
| 1706 |
|
| 1707 |
image_input.change(
|
| 1708 |
+
fn=update_image_preview,
|
| 1709 |
+
inputs=[image_input],
|
| 1710 |
+
outputs=[image_preview]
|
| 1711 |
).then(fn=lambda: gr.update(visible=True), inputs=[], outputs=[preview_row])
|
| 1712 |
|
| 1713 |
goal_input.change(
|
| 1714 |
+
fn=update_goal_preview,
|
| 1715 |
+
inputs=[goal_input],
|
| 1716 |
+
outputs=[goal_preview]
|
| 1717 |
).then(fn=lambda: gr.update(visible=True), inputs=[], outputs=[preview_row])
|
| 1718 |
|
| 1719 |
def update_pointcloud_frames(pointcloud_paths):
|