Update app.py
Browse files
app.py
CHANGED
@@ -33,9 +33,15 @@ model_configs = {
|
|
33 |
'vitl': {'encoder': 'vitl', 'features': 256, 'out_channels': [256, 512, 1024, 1024]},
|
34 |
'vitg': {'encoder': 'vitg', 'features': 384, 'out_channels': [1536, 1536, 1536, 1536]}
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
encoder = 'vitg'
|
37 |
model = DepthAnythingV2(**model_configs[encoder])
|
38 |
-
filepath = hf_hub_download(repo_id="
|
39 |
state_dict = torch.load(filepath, map_location="cpu")
|
40 |
model.load_state_dict(state_dict)
|
41 |
model = model.to(DEVICE).eval()
|
|
|
33 |
'vitl': {'encoder': 'vitl', 'features': 256, 'out_channels': [256, 512, 1024, 1024]},
|
34 |
'vitg': {'encoder': 'vitg', 'features': 384, 'out_channels': [1536, 1536, 1536, 1536]}
|
35 |
}
|
36 |
+
encoder2name = {
|
37 |
+
'vits': 'Small',
|
38 |
+
'vitb': 'Base',
|
39 |
+
'vitl': 'Large',
|
40 |
+
'vitg': 'Gaint',
|
41 |
+
}
|
42 |
encoder = 'vitg'
|
43 |
model = DepthAnythingV2(**model_configs[encoder])
|
44 |
+
filepath = hf_hub_download(repo_id=f"depth-anything/Depth-Anything-V2-{encoder2name[encoder]}", filename=f"model.pth", repo_type="model")
|
45 |
state_dict = torch.load(filepath, map_location="cpu")
|
46 |
model.load_state_dict(state_dict)
|
47 |
model = model.to(DEVICE).eval()
|