umuthopeyildirim commited on
Commit
7ab01ae
1 Parent(s): 7b4afc3

Update model loading to support both CPU and GPU

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -27,7 +27,8 @@ css = """
27
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
28
  model = NewCRFDepth(version="large07", inv_depth=False,
29
  max_depth=10, pretrained=None).to(DEVICE).eval()
30
- model.load_state_dict(torch.load('checkpoints/nyu_L.pth'))
 
31
 
32
  title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
33
  description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.
 
27
  DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
28
  model = NewCRFDepth(version="large07", inv_depth=False,
29
  max_depth=10, pretrained=None).to(DEVICE).eval()
30
+ model.load_state_dict(torch.load('checkpoints/nyu_L.pth',
31
+ map_location=torch.device(DEVICE)))
32
 
33
  title = "# IEBins: Iterative Elastic Bins for Monocular Depth Estimation"
34
  description = """Demo for **IEBins: Iterative Elastic Bins for Monocular Depth Estimation**.