moscartong commited on
Commit
1dcf943
1 Parent(s): 83a7b7b

Use DPT_Large model

Browse files
Files changed (1) hide show
  1. app.py +2 -14
app.py CHANGED
@@ -5,25 +5,13 @@ import numpy as np
5
  from PIL import Image
6
  import time
7
 
8
- midas = torch.hub.load("intel-isl/MiDaS", "MiDaS")
9
-
10
- use_large_model = True
11
-
12
- if use_large_model:
13
- midas = torch.hub.load("intel-isl/MiDaS", "MiDaS")
14
- else:
15
- midas = torch.hub.load("intel-isl/MiDaS", "MiDaS_small")
16
 
17
  device = "cpu"
18
  midas.to(device)
19
 
20
  midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")
21
-
22
- if use_large_model:
23
- transform = midas_transforms.default_transform
24
- else:
25
- transform = midas_transforms.small_transform
26
-
27
 
28
  def depth(img):
29
  original_image = img
 
5
  from PIL import Image
6
  import time
7
 
8
+ midas = torch.hub.load("intel-isl/MiDaS", "DPT_Large")
 
 
 
 
 
 
 
9
 
10
  device = "cpu"
11
  midas.to(device)
12
 
13
  midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")
14
+ transform = midas_transforms.dpt_transform
 
 
 
 
 
15
 
16
  def depth(img):
17
  original_image = img