codic commited on
Commit
e9a549c
·
verified ·
1 Parent(s): eac51a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -89,12 +89,18 @@ def process_image(image_path, depth_map_path=None):
89
  try:
90
  gltf_path = create_3d_obj(foreground_flat, blended_depth_image, bg_scaled, image_path)
91
  img = Image.fromarray(blended_depth_image)
92
- return [img, gltf_path]
 
 
 
93
  except Exception as e:
94
  print(f"Error with default depth: {str(e)}. Retrying with a shallower depth.")
95
  gltf_path = create_3d_obj(foreground_flat, blended_depth_image, bg_scaled, image_path, depth=9)
96
  img = Image.fromarray(blended_depth_image)
97
- return [img, gltf_path]
 
 
 
98
 
99
  def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
100
  # Resize background to match the original image size (no cropping)
 
89
  try:
90
  gltf_path = create_3d_obj(foreground_flat, blended_depth_image, bg_scaled, image_path)
91
  img = Image.fromarray(blended_depth_image)
92
+
93
+ # Ensure a placeholder for the 3D model output
94
+ model_3d = gr.Model3D() # Add a placeholder for Model3D output
95
+ return [img, model_3d, gltf_path] # Return all three outputs
96
  except Exception as e:
97
  print(f"Error with default depth: {str(e)}. Retrying with a shallower depth.")
98
  gltf_path = create_3d_obj(foreground_flat, blended_depth_image, bg_scaled, image_path, depth=9)
99
  img = Image.fromarray(blended_depth_image)
100
+
101
+ # Ensure a placeholder for the 3D model output
102
+ model_3d = gr.Model3D() # Add a placeholder for Model3D output
103
+ return [img, model_3d, gltf_path] # Return all three outputs
104
 
105
  def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
106
  # Resize background to match the original image size (no cropping)