jbilcke-hf HF Staff commited on
Commit
3581570
·
verified ·
1 Parent(s): c87c1cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -271,6 +271,8 @@ class GPUSatelliteModelGenerator:
271
  def generate_mesh_gpu(self, height_map, texture_img):
272
  """Generate optimized 3D mesh with tree geometry"""
273
  height_map_gpu = cp.asarray(height_map)
 
 
274
  height, width = height_map.shape
275
 
276
  # Generate base vertices
@@ -278,7 +280,7 @@ class GPUSatelliteModelGenerator:
278
  vertices = cp.stack([x, height_map_gpu * self.building_height, z], axis=-1)
279
 
280
  # Detect tree areas and generate tree geometry
281
- tree_mask = cp.all(texture_img == self.colors['dark_green'], axis=2)
282
  vertices = self.generate_tree_vertices(tree_mask, vertices.reshape(-1, 3))
283
 
284
  # Normalize coordinates
@@ -293,6 +295,7 @@ class GPUSatelliteModelGenerator:
293
 
294
  # Create textured mesh
295
  return self.create_textured_mesh(vertices, faces, uvs, texture_img)
 
296
 
297
  @staticmethod
298
  def generate_faces_gpu(height, width):
 
271
  def generate_mesh_gpu(self, height_map, texture_img):
272
  """Generate optimized 3D mesh with tree geometry"""
273
  height_map_gpu = cp.asarray(height_map)
274
+ # Convert texture_img to CuPy array
275
+ texture_img_gpu = cp.asarray(texture_img)
276
  height, width = height_map.shape
277
 
278
  # Generate base vertices
 
280
  vertices = cp.stack([x, height_map_gpu * self.building_height, z], axis=-1)
281
 
282
  # Detect tree areas and generate tree geometry
283
+ tree_mask = cp.all(texture_img_gpu == self.colors['dark_green'], axis=2)
284
  vertices = self.generate_tree_vertices(tree_mask, vertices.reshape(-1, 3))
285
 
286
  # Normalize coordinates
 
295
 
296
  # Create textured mesh
297
  return self.create_textured_mesh(vertices, faces, uvs, texture_img)
298
+
299
 
300
  @staticmethod
301
  def generate_faces_gpu(height, width):