Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,8 @@ def predict_depth(model, image):
|
|
22 |
def make_video(video_path, outdir='./vis_video_depth',encoder='vitl'):
|
23 |
if encoder not in ["vitl","vitb","vits"]:
|
24 |
encoder = "vits"
|
|
|
|
|
25 |
# DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
26 |
# model = DepthAnything.from_pretrained('LiheYoung/depth_anything_vitl14').to(DEVICE).eval()
|
27 |
# Define path for temporary processed frames
|
@@ -33,7 +35,7 @@ def make_video(video_path, outdir='./vis_video_depth',encoder='vitl'):
|
|
33 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
34 |
DEVICE = "cuda"
|
35 |
# depth_anything = DepthAnything.from_pretrained('LiheYoung/depth_anything_{}14'.format(encoder)).to(DEVICE).eval()
|
36 |
-
depth_anything = pipeline(task = "depth-estimation", model="nielsr/depth-anything-
|
37 |
|
38 |
# total_params = sum(param.numel() for param in depth_anything.parameters())
|
39 |
# print('Total parameters: {:.2f}M'.format(total_params / 1e6))
|
|
|
22 |
def make_video(video_path, outdir='./vis_video_depth',encoder='vitl'):
|
23 |
if encoder not in ["vitl","vitb","vits"]:
|
24 |
encoder = "vits"
|
25 |
+
|
26 |
+
mapper = {"vits":"small","vitb":"big","vitl":"large"}
|
27 |
# DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
28 |
# model = DepthAnything.from_pretrained('LiheYoung/depth_anything_vitl14').to(DEVICE).eval()
|
29 |
# Define path for temporary processed frames
|
|
|
35 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
36 |
DEVICE = "cuda"
|
37 |
# depth_anything = DepthAnything.from_pretrained('LiheYoung/depth_anything_{}14'.format(encoder)).to(DEVICE).eval()
|
38 |
+
depth_anything = pipeline(task = "depth-estimation", model=f"nielsr/depth-anything-{mapper[encoder]}", device=0)
|
39 |
|
40 |
# total_params = sum(param.numel() for param in depth_anything.parameters())
|
41 |
# print('Total parameters: {:.2f}M'.format(total_params / 1e6))
|