Update app.py
Browse files
app.py
CHANGED
|
@@ -28,7 +28,7 @@ def process_image(image_path, depth_map_path=None):
|
|
| 28 |
foreground = remove(image_raw)
|
| 29 |
foreground = Image.fromarray(np.array(foreground)).convert("RGB")
|
| 30 |
|
| 31 |
-
#
|
| 32 |
if depth_map_path:
|
| 33 |
if depth_map_path.endswith('.npy'):
|
| 34 |
depth_image = np.load(depth_map_path).astype(np.float32)
|
|
@@ -165,7 +165,7 @@ def create_3d_obj(foreground, depth_image, image_path, depth=12):
|
|
| 165 |
o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
|
| 166 |
|
| 167 |
return gltf_path
|
| 168 |
-
|
| 169 |
# Gradio Interface
|
| 170 |
title = "Depth Estimation & 3D Reconstruction Demo"
|
| 171 |
description = "Upload an image and optionally a depth map (in .npy or image format) to generate a 3D model. If no depth map is provided, the DPT model will generate it."
|
|
|
|
| 28 |
foreground = remove(image_raw)
|
| 29 |
foreground = Image.fromarray(np.array(foreground)).convert("RGB")
|
| 30 |
|
| 31 |
+
# Load or generate depth map
|
| 32 |
if depth_map_path:
|
| 33 |
if depth_map_path.endswith('.npy'):
|
| 34 |
depth_image = np.load(depth_map_path).astype(np.float32)
|
|
|
|
| 165 |
o3d.io.write_triangle_mesh(gltf_path, mesh_crop, write_triangle_uvs=True)
|
| 166 |
|
| 167 |
return gltf_path
|
| 168 |
+
|
| 169 |
# Gradio Interface
|
| 170 |
title = "Depth Estimation & 3D Reconstruction Demo"
|
| 171 |
description = "Upload an image and optionally a depth map (in .npy or image format) to generate a 3D model. If no depth map is provided, the DPT model will generate it."
|