Spaces:
Running
Running
change layout
Browse files
app.py
CHANGED
|
@@ -85,6 +85,7 @@ def run_rerun(path_to_video):
|
|
| 85 |
focal_length=focal_length,
|
| 86 |
principal_point=(frame.shape[1] / 2, frame.shape[0] / 2),
|
| 87 |
image_plane_distance=depth.max(),
|
|
|
|
| 88 |
),
|
| 89 |
)
|
| 90 |
|
|
@@ -98,7 +99,7 @@ def run_rerun(path_to_video):
|
|
| 98 |
yield stream.read()
|
| 99 |
|
| 100 |
|
| 101 |
-
@spaces.GPU(duration=
|
| 102 |
def estimate_depth(frame):
|
| 103 |
image = transform(frame)
|
| 104 |
image = image.to(device)
|
|
@@ -110,13 +111,14 @@ def estimate_depth(frame):
|
|
| 110 |
|
| 111 |
|
| 112 |
with gr.Blocks() as demo:
|
| 113 |
-
video = gr.Video(interactive=True, include_audio=False, label="Video")
|
| 114 |
-
visualize = gr.Button("Visualize ML Depth Pro")
|
| 115 |
-
|
| 116 |
with gr.Row():
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
visualize.click(run_rerun, inputs=[video], outputs=[viewer])
|
| 121 |
|
| 122 |
|
|
|
|
| 85 |
focal_length=focal_length,
|
| 86 |
principal_point=(frame.shape[1] / 2, frame.shape[0] / 2),
|
| 87 |
image_plane_distance=depth.max(),
|
| 88 |
+
camera_xyz=rr.ViewCoordinates.FLU,
|
| 89 |
),
|
| 90 |
)
|
| 91 |
|
|
|
|
| 99 |
yield stream.read()
|
| 100 |
|
| 101 |
|
| 102 |
+
@spaces.GPU(duration=40)
|
| 103 |
def estimate_depth(frame):
|
| 104 |
image = transform(frame)
|
| 105 |
image = image.to(device)
|
|
|
|
| 111 |
|
| 112 |
|
| 113 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
| 114 |
with gr.Row():
|
| 115 |
+
with gr.Column(variant="compact"):
|
| 116 |
+
video = gr.Video(interactive=True, include_audio=False, label="Video")
|
| 117 |
+
visualize = gr.Button("Visualize ML Depth Pro")
|
| 118 |
+
with gr.Column():
|
| 119 |
+
viewer = Rerun(
|
| 120 |
+
streaming=True,
|
| 121 |
+
)
|
| 122 |
visualize.click(run_rerun, inputs=[video], outputs=[viewer])
|
| 123 |
|
| 124 |
|