umuthopeyildirim commited on
Commit
f1ab9e0
1 Parent(s): 5d13e86

Fix saving of output image in app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -103,11 +103,12 @@ with gr.Blocks(css=css) as demo:
103
  pred_depths_r_list[-1], pred_depths_r_list_flipped[-1])
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])
 
103
  pred_depths_r_list[-1], pred_depths_r_list_flipped[-1])
104
 
105
  pred_depth = pred_depth.cpu().numpy().squeeze()
106
+ output_image = plt.imsave('depth.png', pred_depth, cmap='jet')
107
 
108
  tmp = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
109
+ output_image.save(tmp.name)
110
 
111
+ return [(original_image, output_image), tmp.name]
112
 
113
  submit.click(on_submit, inputs=[input_image], outputs=[
114
  depth_image_slider, raw_file])