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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -19
app.py CHANGED
@@ -93,25 +93,7 @@ with gr.Blocks(css=css) as demo:
93
  print("Type of depth:", type(depth))
94
  print("Shape of depth:", depth.shape if isinstance(depth, np.ndarray) else "N/A")
95
 
96
- if isinstance(depth, np.ndarray):
97
- print("Data type of depth:", depth.dtype)
98
-
99
- # Ensure depth is a NumPy array and has the correct shape and dtype
100
- if not isinstance(depth, np.ndarray):
101
- raise TypeError("Expected a NumPy array for depth, but got {}".format(type(depth)))
102
-
103
- # Adjust the depth array if needed
104
- if depth.ndim == 2:
105
- # 2D array: expected for grayscale depth maps
106
- depth = depth.astype('uint16') # Convert to a suitable type
107
- elif depth.ndim == 3 and depth.shape[2] == 1:
108
- # 3D array with a single channel (e.g., shape (H, W, 1))
109
- depth = depth[:, :, 0].astype('uint16')
110
- else:
111
- raise ValueError("Unsupported depth array shape: {}".format(depth.shape))
112
-
113
- # Now convert to a PIL Image
114
- raw_depth = Image.fromarray(depth)
115
  tmp_raw_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
116
  raw_depth.save(tmp_raw_depth.name)
117
 
 
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