Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,8 +122,8 @@ def predict_depth(image: Image.Image):
|
|
| 122 |
# Step 1: Depth refinement
|
| 123 |
depth_image_cleaned = depth_subject_only
|
| 124 |
|
| 125 |
-
|
| 126 |
-
depth_image =
|
| 127 |
|
| 128 |
# Step 3: Smooth depth map with Gaussian filter
|
| 129 |
depth_image = cv2.GaussianBlur(depth_image, (5, 5), sigmaX=3, sigmaY=3)
|
|
@@ -159,6 +159,7 @@ def predict_depth(image: Image.Image):
|
|
| 159 |
print(f"Error in depth prediction or processing: {type(e).__name__} - {e}")
|
| 160 |
return None, None
|
| 161 |
|
|
|
|
| 162 |
def get_mesh(image: Image.Image, depth, image_path: str, foreground: np.ndarray):
|
| 163 |
"""Generate a 3D mesh with high-resolution texturing from the depth map."""
|
| 164 |
try:
|
|
|
|
| 122 |
# Step 1: Depth refinement
|
| 123 |
depth_image_cleaned = depth_subject_only
|
| 124 |
|
| 125 |
+
# Assign the cleaned depth image to the depth_image variable
|
| 126 |
+
depth_image = depth_image_cleaned.astype(np.float32) / 255 # Normalize back to [0, 1]
|
| 127 |
|
| 128 |
# Step 3: Smooth depth map with Gaussian filter
|
| 129 |
depth_image = cv2.GaussianBlur(depth_image, (5, 5), sigmaX=3, sigmaY=3)
|
|
|
|
| 159 |
print(f"Error in depth prediction or processing: {type(e).__name__} - {e}")
|
| 160 |
return None, None
|
| 161 |
|
| 162 |
+
|
| 163 |
def get_mesh(image: Image.Image, depth, image_path: str, foreground: np.ndarray):
|
| 164 |
"""Generate a 3D mesh with high-resolution texturing from the depth map."""
|
| 165 |
try:
|