Spaces:
Sleeping
Sleeping
move to device on stateless gpu
Browse files
app.py
CHANGED
@@ -70,9 +70,7 @@ def run_rerun(path_to_video):
|
|
70 |
rr.log("world/camera/image", rr.Image(frame))
|
71 |
yield stream.read()
|
72 |
|
73 |
-
|
74 |
-
image = image.to(device)
|
75 |
-
depth, focal_length = estimate_depth(image)
|
76 |
|
77 |
rr.log(
|
78 |
"world/camera",
|
@@ -96,7 +94,9 @@ def run_rerun(path_to_video):
|
|
96 |
|
97 |
|
98 |
@spaces.GPU(duration=20)
|
99 |
-
def estimate_depth(
|
|
|
|
|
100 |
prediction = model.infer(image)
|
101 |
depth = prediction["depth"].squeeze().detach().cpu().numpy()
|
102 |
focal_length = prediction["focallength_px"].item()
|
|
|
70 |
rr.log("world/camera/image", rr.Image(frame))
|
71 |
yield stream.read()
|
72 |
|
73 |
+
depth, focal_length = estimate_depth(frame)
|
|
|
|
|
74 |
|
75 |
rr.log(
|
76 |
"world/camera",
|
|
|
94 |
|
95 |
|
96 |
@spaces.GPU(duration=20)
|
97 |
+
def estimate_depth(frame):
|
98 |
+
image = transform(frame)
|
99 |
+
image = image.to(device)
|
100 |
prediction = model.infer(image)
|
101 |
depth = prediction["depth"].squeeze().detach().cpu().numpy()
|
102 |
focal_length = prediction["focallength_px"].item()
|