Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,11 +20,8 @@ def write_depth(depth, bits):
|
|
| 20 |
out = max_val * (depth - depth_min) / (depth_max - depth_min)
|
| 21 |
else:
|
| 22 |
out = np.zeros(depth.shape, dtype=depth.dtype)
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
cv2.imwrite("result.png", out.astype("uint8"), [cv2.IMWRITE_PNG_COMPRESSION, 0])
|
| 26 |
-
|
| 27 |
-
return
|
| 28 |
|
| 29 |
def process_image(image):
|
| 30 |
# prepare image for the model
|
|
@@ -57,7 +54,7 @@ examples =[['cats.jpg']]
|
|
| 57 |
|
| 58 |
iface = gr.Interface(fn=process_image,
|
| 59 |
inputs=gr.inputs.Image(type="pil"),
|
| 60 |
-
outputs=gr.outputs.Image(
|
| 61 |
title=title,
|
| 62 |
description=description,
|
| 63 |
examples=examples,
|
|
|
|
| 20 |
out = max_val * (depth - depth_min) / (depth_max - depth_min)
|
| 21 |
else:
|
| 22 |
out = np.zeros(depth.shape, dtype=depth.dtype)
|
| 23 |
+
|
| 24 |
+
return out/65536
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
def process_image(image):
|
| 27 |
# prepare image for the model
|
|
|
|
| 54 |
|
| 55 |
iface = gr.Interface(fn=process_image,
|
| 56 |
inputs=gr.inputs.Image(type="pil"),
|
| 57 |
+
outputs=gr.outputs.Image(label="predicted depth"),
|
| 58 |
title=title,
|
| 59 |
description=description,
|
| 60 |
examples=examples,
|