LiheYoung commited on
Commit
b107635
1 Parent(s): 19c4b4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import spaces
2
  import gradio as gr
3
  import cv2
4
  import numpy as np
@@ -46,11 +45,6 @@ transform = Compose([
46
  PrepareForNet(),
47
  ])
48
 
49
- @spaces.GPU
50
- def predict_depth(model, image):
51
- with torch.no_grad():
52
- return model(image)
53
-
54
  with gr.Blocks(css=css) as demo:
55
  gr.Markdown(title)
56
  gr.Markdown(description)
@@ -69,7 +63,8 @@ with gr.Blocks(css=css) as demo:
69
  image = transform({'image': image})['image']
70
  image = torch.from_numpy(image).unsqueeze(0).to(DEVICE)
71
 
72
- depth = predict_depth(model, image)
 
73
  depth = F.interpolate(depth[None], (h, w), mode='bilinear', align_corners=False)[0, 0]
74
 
75
  raw_depth = Image.fromarray(depth.cpu().numpy().astype('uint16'))
 
 
1
  import gradio as gr
2
  import cv2
3
  import numpy as np
 
45
  PrepareForNet(),
46
  ])
47
 
 
 
 
 
 
48
  with gr.Blocks(css=css) as demo:
49
  gr.Markdown(title)
50
  gr.Markdown(description)
 
63
  image = transform({'image': image})['image']
64
  image = torch.from_numpy(image).unsqueeze(0).to(DEVICE)
65
 
66
+ with torch.no_grad():
67
+ depth = model(image)
68
  depth = F.interpolate(depth[None], (h, w), mode='bilinear', align_corners=False)[0, 0]
69
 
70
  raw_depth = Image.fromarray(depth.cpu().numpy().astype('uint16'))