zino36 commited on
Commit
3ce799d
·
verified ·
1 Parent(s): 4ad265b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -80,20 +80,13 @@ with gr.Blocks(css=css) as demo:
80
  cmap = matplotlib.colormaps.get_cmap('Spectral_r')
81
 
82
  def on_submit(image):
83
- if isinstance(image, np.ndarray):
84
- image = Image.fromarray(image)
85
-
86
  original_image = image.copy()
87
-
88
- h, w = image.size # For PIL images, use .size instead of .shape
89
-
90
- depth = predict_depth(image)
91
-
92
- # Debugging info
93
- print("Type of depth:", type(depth))
94
- print("Shape of depth:", depth.shape if isinstance(depth, np.ndarray) else "N/A")
95
-
96
- raw_depth = depth
97
  tmp_raw_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
98
  raw_depth.save(tmp_raw_depth.name)
99
 
 
80
  cmap = matplotlib.colormaps.get_cmap('Spectral_r')
81
 
82
  def on_submit(image):
 
 
 
83
  original_image = image.copy()
84
+
85
+ h, w = image.shape[:2]
86
+
87
+ depth = predict_depth(image[:, :, ::-1])
88
+
89
+ raw_depth = Image.fromarray(depth.astype('uint16'))
 
 
 
 
90
  tmp_raw_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
91
  raw_depth.save(tmp_raw_depth.name)
92