Spaces:
Running
Running
Update app.py
Browse files
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
|
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 |
-
|
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 |
|