Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
f69b2cb
1
Parent(s):
b77de08
update example
Browse files
app.py
CHANGED
@@ -461,7 +461,7 @@ def save_output_files(
|
|
461 |
return paths
|
462 |
|
463 |
|
464 |
-
@spaces.GPU(duration=
|
465 |
def process_reconstruction(
|
466 |
video_file,
|
467 |
height,
|
@@ -860,26 +860,24 @@ def update_task_ui(task):
|
|
860 |
"""Update UI elements based on selected task."""
|
861 |
if task == "reconstruction":
|
862 |
return (
|
863 |
-
gr.update(visible=True), #
|
864 |
-
gr.update(visible=False), #
|
865 |
-
gr.update(visible=False), #
|
866 |
-
gr.update(visible=False), #
|
867 |
-
gr.update(visible=False), # goal_preview
|
868 |
gr.update(value=4), # num_inference_steps
|
869 |
gr.update(visible=True), # sliding_window_stride
|
870 |
gr.update(visible=False), # use_dynamic_cfg
|
871 |
gr.update(visible=False), # raymap_option
|
872 |
gr.update(visible=False), # post_reconstruction
|
873 |
gr.update(value=1.0), # guidance_scale
|
874 |
-
gr.update(visible=
|
875 |
)
|
876 |
elif task == "prediction":
|
877 |
return (
|
878 |
-
gr.update(visible=False), #
|
879 |
-
gr.update(visible=True), #
|
880 |
-
gr.update(visible=False), #
|
881 |
-
gr.update(visible=True), #
|
882 |
-
gr.update(visible=False), # goal_preview
|
883 |
gr.update(value=50), # num_inference_steps
|
884 |
gr.update(visible=False), # sliding_window_stride
|
885 |
gr.update(visible=True), # use_dynamic_cfg
|
@@ -890,11 +888,10 @@ def update_task_ui(task):
|
|
890 |
)
|
891 |
elif task == "planning":
|
892 |
return (
|
893 |
-
gr.update(visible=False), #
|
894 |
-
gr.update(visible=
|
895 |
-
gr.update(visible=True), #
|
896 |
-
gr.update(visible=True), #
|
897 |
-
gr.update(visible=True), # goal_preview
|
898 |
gr.update(value=50), # num_inference_steps
|
899 |
gr.update(visible=False), # sliding_window_stride
|
900 |
gr.update(visible=True), # use_dynamic_cfg
|
@@ -1389,44 +1386,85 @@ with gr.Blocks(
|
|
1389 |
gpu_time_warning = gr.Markdown(
|
1390 |
"""
|
1391 |
<div class="warning-box">
|
1392 |
-
<strong>⚠️
|
1393 |
-
|
1394 |
-
|
|
|
1395 |
</div>
|
1396 |
""",
|
1397 |
visible=False
|
1398 |
)
|
1399 |
|
1400 |
with gr.Group(elem_classes=["input-section"]):
|
1401 |
-
# Input section - changes based on task
|
1402 |
gr.Markdown("## 📥 Input", elem_classes=["task-header"])
|
1403 |
|
1404 |
# Task-specific inputs
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1412 |
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1421 |
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1430 |
|
1431 |
with gr.Row(visible=False) as preview_row:
|
1432 |
image_preview = gr.Image(
|
@@ -1646,58 +1684,15 @@ with gr.Blocks(
|
|
1646 |
"""
|
1647 |
)
|
1648 |
|
1649 |
-
# Example Accordion
|
1650 |
-
with gr.Tab("Reconstruction"):
|
1651 |
-
reconstruction_examples = gr.Examples(
|
1652 |
-
examples=[
|
1653 |
-
["assets/example_videos/bridge.mp4"],
|
1654 |
-
["assets/example_videos/moviegen.mp4"],
|
1655 |
-
["assets/example_videos/nuscenes.mp4"],
|
1656 |
-
["assets/example_videos/veo2.mp4"],
|
1657 |
-
],
|
1658 |
-
inputs=[video_input],
|
1659 |
-
label="Reconstruction Examples",
|
1660 |
-
fn=lambda x: {"task": gr.update(value="reconstruction")}
|
1661 |
-
)
|
1662 |
-
|
1663 |
-
with gr.Tab("Prediction"):
|
1664 |
-
prediction_examples = gr.Examples(
|
1665 |
-
examples=[
|
1666 |
-
["assets/example_obs/car.png"],
|
1667 |
-
["assets/example_obs/cartoon.png"],
|
1668 |
-
["assets/example_obs/garden.jpg"],
|
1669 |
-
["assets/example_obs/room.jpg"],
|
1670 |
-
],
|
1671 |
-
inputs=[image_input],
|
1672 |
-
label="Prediction Examples",
|
1673 |
-
fn=lambda x: {"task": gr.update(value="prediction")},
|
1674 |
-
examples_per_page=4,
|
1675 |
-
)
|
1676 |
-
|
1677 |
-
with gr.Tab("Planning"):
|
1678 |
-
planning_examples = gr.Examples(
|
1679 |
-
examples=[
|
1680 |
-
["assets/example_obs_goal/01_obs.png", "assets/example_obs_goal/01_goal.png"],
|
1681 |
-
["assets/example_obs_goal/02_obs.png", "assets/example_obs_goal/02_goal.png"],
|
1682 |
-
["assets/example_obs_goal/03_obs.png", "assets/example_obs_goal/03_goal.png"],
|
1683 |
-
["assets/example_obs_goal/04_obs.png", "assets/example_obs_goal/04_goal.png"],
|
1684 |
-
],
|
1685 |
-
inputs=[image_input, goal_input],
|
1686 |
-
label="Planning Examples",
|
1687 |
-
fn=lambda x: {"task": gr.update(value="planning")},
|
1688 |
-
examples_per_page=4,
|
1689 |
-
)
|
1690 |
-
|
1691 |
# Event handlers
|
1692 |
task.change(
|
1693 |
fn=update_task_ui,
|
1694 |
inputs=[task],
|
1695 |
outputs=[
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
goal_preview,
|
1701 |
num_inference_steps,
|
1702 |
sliding_window_stride,
|
1703 |
use_dynamic_cfg,
|
|
|
461 |
return paths
|
462 |
|
463 |
|
464 |
+
@spaces.GPU(duration=300)
|
465 |
def process_reconstruction(
|
466 |
video_file,
|
467 |
height,
|
|
|
860 |
"""Update UI elements based on selected task."""
|
861 |
if task == "reconstruction":
|
862 |
return (
|
863 |
+
gr.update(visible=True), # reconstruction_group
|
864 |
+
gr.update(visible=False), # prediction_group
|
865 |
+
gr.update(visible=False), # planning_group
|
866 |
+
gr.update(visible=False), # preview_row
|
|
|
867 |
gr.update(value=4), # num_inference_steps
|
868 |
gr.update(visible=True), # sliding_window_stride
|
869 |
gr.update(visible=False), # use_dynamic_cfg
|
870 |
gr.update(visible=False), # raymap_option
|
871 |
gr.update(visible=False), # post_reconstruction
|
872 |
gr.update(value=1.0), # guidance_scale
|
873 |
+
gr.update(visible=True), # gpu_time_warning
|
874 |
)
|
875 |
elif task == "prediction":
|
876 |
return (
|
877 |
+
gr.update(visible=False), # reconstruction_group
|
878 |
+
gr.update(visible=True), # prediction_group
|
879 |
+
gr.update(visible=False), # planning_group
|
880 |
+
gr.update(visible=True), # preview_row
|
|
|
881 |
gr.update(value=50), # num_inference_steps
|
882 |
gr.update(visible=False), # sliding_window_stride
|
883 |
gr.update(visible=True), # use_dynamic_cfg
|
|
|
888 |
)
|
889 |
elif task == "planning":
|
890 |
return (
|
891 |
+
gr.update(visible=False), # reconstruction_group
|
892 |
+
gr.update(visible=False), # prediction_group
|
893 |
+
gr.update(visible=True), # planning_group
|
894 |
+
gr.update(visible=True), # preview_row
|
|
|
895 |
gr.update(value=50), # num_inference_steps
|
896 |
gr.update(visible=False), # sliding_window_stride
|
897 |
gr.update(visible=True), # use_dynamic_cfg
|
|
|
1386 |
gpu_time_warning = gr.Markdown(
|
1387 |
"""
|
1388 |
<div class="warning-box">
|
1389 |
+
<strong>⚠️ Warning:</strong> Due to HuggingFace Spaces ZERO GPU quota limitations,
|
1390 |
+
only short video reconstruction tasks (less than 10s) can be completed online.
|
1391 |
+
For long video reconstruction, prediction, and planning tasks, we strongly
|
1392 |
+
recommend deploying the model locally to experience the full capabilities of Aether.
|
1393 |
</div>
|
1394 |
""",
|
1395 |
visible=False
|
1396 |
)
|
1397 |
|
1398 |
with gr.Group(elem_classes=["input-section"]):
|
|
|
1399 |
gr.Markdown("## 📥 Input", elem_classes=["task-header"])
|
1400 |
|
1401 |
# Task-specific inputs
|
1402 |
+
with gr.Group(visible=True) as reconstruction_group:
|
1403 |
+
video_input = gr.Video(
|
1404 |
+
label="Upload Input Video",
|
1405 |
+
sources=["upload"],
|
1406 |
+
interactive=True,
|
1407 |
+
elem_id="video_input",
|
1408 |
+
)
|
1409 |
+
reconstruction_examples = gr.Examples(
|
1410 |
+
examples=[
|
1411 |
+
["assets/example_videos/bridge.mp4"],
|
1412 |
+
["assets/example_videos/moviegen.mp4"],
|
1413 |
+
["assets/example_videos/nuscenes.mp4"],
|
1414 |
+
["assets/example_videos/veo2.mp4"],
|
1415 |
+
],
|
1416 |
+
inputs=[video_input],
|
1417 |
+
label="Reconstruction Examples",
|
1418 |
+
examples_per_page=4,
|
1419 |
+
)
|
1420 |
|
1421 |
+
with gr.Group(visible=False) as prediction_group:
|
1422 |
+
image_input = gr.File(
|
1423 |
+
label="Upload Start Image",
|
1424 |
+
file_count="single",
|
1425 |
+
file_types=["image"],
|
1426 |
+
interactive=True,
|
1427 |
+
elem_id="image_input",
|
1428 |
+
)
|
1429 |
+
prediction_examples = gr.Examples(
|
1430 |
+
examples=[
|
1431 |
+
["assets/example_obs/car.png"],
|
1432 |
+
["assets/example_obs/cartoon.png"],
|
1433 |
+
["assets/example_obs/garden.jpg"],
|
1434 |
+
["assets/example_obs/room.jpg"],
|
1435 |
+
],
|
1436 |
+
inputs=[image_input],
|
1437 |
+
label="Prediction Examples",
|
1438 |
+
examples_per_page=4,
|
1439 |
+
)
|
1440 |
|
1441 |
+
with gr.Group(visible=False) as planning_group:
|
1442 |
+
with gr.Row():
|
1443 |
+
image_input_planning = gr.File(
|
1444 |
+
label="Upload Start Image",
|
1445 |
+
file_count="single",
|
1446 |
+
file_types=["image"],
|
1447 |
+
interactive=True,
|
1448 |
+
elem_id="image_input_planning",
|
1449 |
+
)
|
1450 |
+
goal_input = gr.File(
|
1451 |
+
label="Upload Goal Image",
|
1452 |
+
file_count="single",
|
1453 |
+
file_types=["image"],
|
1454 |
+
interactive=True,
|
1455 |
+
elem_id="goal_input",
|
1456 |
+
)
|
1457 |
+
planning_examples = gr.Examples(
|
1458 |
+
examples=[
|
1459 |
+
["assets/example_obs_goal/01_obs.png", "assets/example_obs_goal/01_goal.png"],
|
1460 |
+
["assets/example_obs_goal/02_obs.png", "assets/example_obs_goal/02_goal.png"],
|
1461 |
+
["assets/example_obs_goal/03_obs.png", "assets/example_obs_goal/03_goal.png"],
|
1462 |
+
["assets/example_obs_goal/04_obs.png", "assets/example_obs_goal/04_goal.png"],
|
1463 |
+
],
|
1464 |
+
inputs=[image_input_planning, goal_input],
|
1465 |
+
label="Planning Examples",
|
1466 |
+
examples_per_page=4,
|
1467 |
+
)
|
1468 |
|
1469 |
with gr.Row(visible=False) as preview_row:
|
1470 |
image_preview = gr.Image(
|
|
|
1684 |
"""
|
1685 |
)
|
1686 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1687 |
# Event handlers
|
1688 |
task.change(
|
1689 |
fn=update_task_ui,
|
1690 |
inputs=[task],
|
1691 |
outputs=[
|
1692 |
+
reconstruction_group,
|
1693 |
+
prediction_group,
|
1694 |
+
planning_group,
|
1695 |
+
preview_row,
|
|
|
1696 |
num_inference_steps,
|
1697 |
sliding_window_stride,
|
1698 |
use_dynamic_cfg,
|