umuthopeyildirim
commited on
Commit
•
5d13e86
1
Parent(s):
b48db1d
Refactor depth image saving logic
Browse files
app.py
CHANGED
@@ -104,16 +104,10 @@ with gr.Blocks(css=css) as demo:
|
|
104 |
|
105 |
pred_depth = pred_depth.cpu().numpy().squeeze()
|
106 |
|
107 |
-
depth = pred_depth.cpu().numpy().astype(np.uint8)
|
108 |
-
colored_depth = cv2.applyColorMap(
|
109 |
-
depth, cv2.COLORMAP_INFERNO)[:, :, ::-1]
|
110 |
-
|
111 |
-
raw_depth = Image.fromarray(
|
112 |
-
pred_depth.cpu().numpy().astype('uint16'))
|
113 |
tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
114 |
-
|
115 |
|
116 |
-
return [(original_image,
|
117 |
|
118 |
submit.click(on_submit, inputs=[input_image], outputs=[
|
119 |
depth_image_slider, raw_file])
|
|
|
104 |
|
105 |
pred_depth = pred_depth.cpu().numpy().squeeze()
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
108 |
+
pred_depth.save(tmp.name)
|
109 |
|
110 |
+
return [(original_image, tmp.name), tmp.name]
|
111 |
|
112 |
submit.click(on_submit, inputs=[input_image], outputs=[
|
113 |
depth_image_slider, raw_file])
|