Spaces:
Running
Running
webm webcam output?
Browse files- app.py +5 -10
- pyproject.toml +2 -2
- requirements.txt +1 -1
- uv.lock +0 -0
app.py
CHANGED
|
@@ -76,6 +76,7 @@ def predict_depth(input_image):
|
|
| 76 |
@rr.thread_local_stream("rerun_example_ml_depth_pro")
|
| 77 |
def run_rerun(path_to_video):
|
| 78 |
stream = rr.binary_stream()
|
|
|
|
| 79 |
|
| 80 |
blueprint = rrb.Blueprint(
|
| 81 |
rrb.Vertical(
|
|
@@ -93,15 +94,16 @@ def run_rerun(path_to_video):
|
|
| 93 |
rr.send_blueprint(blueprint)
|
| 94 |
|
| 95 |
yield stream.read()
|
|
|
|
| 96 |
video_asset = rr.AssetVideo(path=path_to_video)
|
| 97 |
rr.log("world/video", video_asset, static=True)
|
| 98 |
|
| 99 |
# Send automatically determined video frame timestamps.
|
| 100 |
frame_timestamps_ns = video_asset.read_frame_timestamps_ns()
|
| 101 |
|
| 102 |
-
# load the video using opencv
|
| 103 |
cap = cv2.VideoCapture(path_to_video)
|
| 104 |
-
|
|
|
|
| 105 |
for i in range(len(frame_timestamps_ns)):
|
| 106 |
ret, frame = cap.read()
|
| 107 |
if not ret:
|
|
@@ -161,19 +163,12 @@ def run_rerun(path_to_video):
|
|
| 161 |
yield stream.read()
|
| 162 |
|
| 163 |
|
| 164 |
-
# Example images
|
| 165 |
-
example_images = [
|
| 166 |
-
"examples/lemur.jpg",
|
| 167 |
-
"examples/cat.jpg",
|
| 168 |
-
"examples/silly-cat.png",
|
| 169 |
-
]
|
| 170 |
-
|
| 171 |
with gr.Blocks() as interface:
|
| 172 |
gr.Markdown(
|
| 173 |
"""
|
| 174 |
# DepthPro Rerun Demo
|
| 175 |
|
| 176 |
-
[DepthPro](https://huggingface.co/apple/DepthPro) is a fast metric depth prediction model. Simply upload
|
| 177 |
|
| 178 |
High resolution videos will be automatically resized to 256x256 pixels, to speed up the inference and visualize multiple frames.
|
| 179 |
"""
|
|
|
|
| 76 |
@rr.thread_local_stream("rerun_example_ml_depth_pro")
|
| 77 |
def run_rerun(path_to_video):
|
| 78 |
stream = rr.binary_stream()
|
| 79 |
+
print("video path:", path_to_video)
|
| 80 |
|
| 81 |
blueprint = rrb.Blueprint(
|
| 82 |
rrb.Vertical(
|
|
|
|
| 94 |
rr.send_blueprint(blueprint)
|
| 95 |
|
| 96 |
yield stream.read()
|
| 97 |
+
|
| 98 |
video_asset = rr.AssetVideo(path=path_to_video)
|
| 99 |
rr.log("world/video", video_asset, static=True)
|
| 100 |
|
| 101 |
# Send automatically determined video frame timestamps.
|
| 102 |
frame_timestamps_ns = video_asset.read_frame_timestamps_ns()
|
| 103 |
|
|
|
|
| 104 |
cap = cv2.VideoCapture(path_to_video)
|
| 105 |
+
num_frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)
|
| 106 |
+
print(f"Number of frames in the video: {num_frames}")
|
| 107 |
for i in range(len(frame_timestamps_ns)):
|
| 108 |
ret, frame = cap.read()
|
| 109 |
if not ret:
|
|
|
|
| 163 |
yield stream.read()
|
| 164 |
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
with gr.Blocks() as interface:
|
| 167 |
gr.Markdown(
|
| 168 |
"""
|
| 169 |
# DepthPro Rerun Demo
|
| 170 |
|
| 171 |
+
[DepthPro](https://huggingface.co/apple/DepthPro) is a fast metric depth prediction model. Simply upload a video to visualize the depth predictions in real-time.
|
| 172 |
|
| 173 |
High resolution videos will be automatically resized to 256x256 pixels, to speed up the inference and visualize multiple frames.
|
| 174 |
"""
|
pyproject.toml
CHANGED
|
@@ -3,14 +3,14 @@ name = "rerun-apple-depth-pro"
|
|
| 3 |
version = "0.1.0"
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
-
requires-python = ">=3.
|
| 7 |
dependencies = [
|
| 8 |
"attrs>=24.2.0",
|
| 9 |
"depth-pro",
|
| 10 |
"gradio>=4.44.1",
|
| 11 |
"gradio-rerun>=0.0.8",
|
| 12 |
"rerun-sdk==0.19.0",
|
| 13 |
-
"spaces>=0.30.
|
| 14 |
]
|
| 15 |
|
| 16 |
[tool.uv]
|
|
|
|
| 3 |
version = "0.1.0"
|
| 4 |
description = "Add your description here"
|
| 5 |
readme = "README.md"
|
| 6 |
+
requires-python = ">=3.8"
|
| 7 |
dependencies = [
|
| 8 |
"attrs>=24.2.0",
|
| 9 |
"depth-pro",
|
| 10 |
"gradio>=4.44.1",
|
| 11 |
"gradio-rerun>=0.0.8",
|
| 12 |
"rerun-sdk==0.19.0",
|
| 13 |
+
"spaces>=0.30.4",
|
| 14 |
]
|
| 15 |
|
| 16 |
[tool.uv]
|
requirements.txt
CHANGED
|
@@ -80,7 +80,7 @@ semantic-version==2.10.0
|
|
| 80 |
shellingham==1.5.4
|
| 81 |
six==1.16.0
|
| 82 |
sniffio==1.3.1
|
| 83 |
-
spaces==0.30.
|
| 84 |
stack-data==0.6.3
|
| 85 |
starlette==0.38.6
|
| 86 |
sympy==1.13.3
|
|
|
|
| 80 |
shellingham==1.5.4
|
| 81 |
six==1.16.0
|
| 82 |
sniffio==1.3.1
|
| 83 |
+
spaces==0.30.4
|
| 84 |
stack-data==0.6.3
|
| 85 |
starlette==0.38.6
|
| 86 |
sympy==1.13.3
|
uv.lock
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|