nielsr HF staff commited on
Commit
1b44370
1 Parent(s): 50243c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -10,7 +10,7 @@ torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/0000000397
10
  feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large")
11
  model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
12
 
13
- def write_depth(depth, bits):
14
  depth_min = depth.min()
15
  depth_max = depth.max()
16
 
@@ -41,10 +41,7 @@ def process_image(image):
41
  )
42
  prediction = prediction.squeeze().cpu().numpy()
43
 
44
- # write predicted depth to file
45
- write_depth(prediction, bits=2)
46
-
47
- result = Image.open("result.png")
48
 
49
  return result
50
 
 
10
  feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large")
11
  model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
12
 
13
+ def compute_depth(depth, bits):
14
  depth_min = depth.min()
15
  depth_max = depth.max()
16
 
 
41
  )
42
  prediction = prediction.squeeze().cpu().numpy()
43
 
44
+ result = compute_depth(prediction, bits=2)
 
 
 
45
 
46
  return result
47