umuthopeyildirim
commited on
Commit
•
b3a5f53
1
Parent(s):
4ab2c91
Refactor depth image saving logic
Browse files
app.py
CHANGED
@@ -102,10 +102,15 @@ with gr.Blocks(css=css) as demo:
|
|
102 |
pred_depth = post_process_depth(
|
103 |
pred_depths_r_list[-1], pred_depths_r_list_flipped[-1])
|
104 |
print("== Finished processing image")
|
105 |
-
pred_depth = pred_depth.cpu().numpy().squeeze()
|
106 |
-
output_image = plt.imsave('depth.png', pred_depth, cmap='jet')
|
107 |
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
submit.click(on_submit, inputs=[input_image], outputs=[
|
111 |
depth_image_slider, raw_file])
|
|
|
102 |
pred_depth = post_process_depth(
|
103 |
pred_depths_r_list[-1], pred_depths_r_list_flipped[-1])
|
104 |
print("== Finished processing image")
|
105 |
+
# pred_depth = pred_depth.cpu().numpy().squeeze()
|
106 |
+
# output_image = plt.imsave('depth.png', pred_depth, cmap='jet')
|
107 |
|
108 |
+
raw_depth = Image.fromarray(
|
109 |
+
pred_depth.cpu().numpy().astype('uint16'))
|
110 |
+
tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
111 |
+
raw_depth.save(tmp.name)
|
112 |
+
|
113 |
+
return [(original_image, original_image), tmp.name]
|
114 |
|
115 |
submit.click(on_submit, inputs=[input_image], outputs=[
|
116 |
depth_image_slider, raw_file])
|