Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,7 +111,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 111 |
)
|
| 112 |
|
| 113 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download",)
|
| 114 |
-
raw_file = gr.File(label="
|
|
|
|
| 115 |
|
| 116 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
| 117 |
|
|
@@ -125,8 +126,8 @@ with gr.Blocks(css=css) as demo:
|
|
| 125 |
depth_npy, depth_colored = predict_depth(pil_image, processing_res_choice)
|
| 126 |
|
| 127 |
# Save the npy data (raw depth map)
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
# Save the grayscale depth map
|
| 132 |
depth_gray = (depth_npy * 65535.0).astype(np.uint16)
|
|
@@ -137,7 +138,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 137 |
tmp_colored_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 138 |
depth_colored.save(tmp_colored_depth.name)
|
| 139 |
|
| 140 |
-
return [(image, depth_colored), tmp_gray_depth.name,
|
| 141 |
|
| 142 |
# h, w = image.shape[:2]
|
| 143 |
|
|
|
|
| 111 |
)
|
| 112 |
|
| 113 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download",)
|
| 114 |
+
raw_file = gr.File(label="Raw Depth Data (.npy)", elem_id="download")
|
| 115 |
+
# raw_file = gr.File(label="16-bit raw output (can be considered as disparity)", elem_id="download",)
|
| 116 |
|
| 117 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
| 118 |
|
|
|
|
| 126 |
depth_npy, depth_colored = predict_depth(pil_image, processing_res_choice)
|
| 127 |
|
| 128 |
# Save the npy data (raw depth map)
|
| 129 |
+
tmp_npy_depth = tempfile.NamedTemporaryFile(suffix='.npy', delete=False)
|
| 130 |
+
np.save(tmp_npy_depth.name, depth_npy)
|
| 131 |
|
| 132 |
# Save the grayscale depth map
|
| 133 |
depth_gray = (depth_npy * 65535.0).astype(np.uint16)
|
|
|
|
| 138 |
tmp_colored_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 139 |
depth_colored.save(tmp_colored_depth.name)
|
| 140 |
|
| 141 |
+
return [(image, depth_colored), tmp_gray_depth.name, tmp_npy_depth.name]
|
| 142 |
|
| 143 |
# h, w = image.shape[:2]
|
| 144 |
|