Update app.py
Browse files
app.py
CHANGED
@@ -86,7 +86,7 @@ def estimate_depth(image, model_name="depth-anything/Depth-Anything-V2-Small-hf"
|
|
86 |
|
87 |
return depth_map
|
88 |
|
89 |
-
def apply_depth_aware_blur(image, max_sigma=
|
90 |
"""Apply depth-aware blur with farther objects more blurred."""
|
91 |
# Estimate depth (1 = farthest)
|
92 |
depth_map = estimate_depth(image)
|
@@ -119,7 +119,7 @@ def process_image(image, blur_type, sigma=15):
|
|
119 |
if blur_type == "Gaussian Background Blur":
|
120 |
result = apply_gaussian_blur(pil_image, sigma)
|
121 |
elif blur_type == "Depth-Aware Lens Blur":
|
122 |
-
result = apply_depth_aware_blur(pil_image, max_sigma
|
123 |
else:
|
124 |
result = pil_image
|
125 |
|
|
|
86 |
|
87 |
return depth_map
|
88 |
|
89 |
+
def apply_depth_aware_blur(image, max_sigma=0, min_sigma=10):
|
90 |
"""Apply depth-aware blur with farther objects more blurred."""
|
91 |
# Estimate depth (1 = farthest)
|
92 |
depth_map = estimate_depth(image)
|
|
|
119 |
if blur_type == "Gaussian Background Blur":
|
120 |
result = apply_gaussian_blur(pil_image, sigma)
|
121 |
elif blur_type == "Depth-Aware Lens Blur":
|
122 |
+
result = apply_depth_aware_blur(pil_image, max_sigma)
|
123 |
else:
|
124 |
result = pil_image
|
125 |
|