Spaces:
Sleeping
Sleeping
removed logs
Browse files
app.py
CHANGED
|
@@ -5,7 +5,6 @@ import numpy as np
|
|
| 5 |
|
| 6 |
# Function to apply Gaussian Blur
|
| 7 |
def apply_gaussian_blur(image, predicted_mask, sigma=15):
|
| 8 |
-
print(f"Predicted Mask: {predicted_mask}")
|
| 9 |
mask = Image.fromarray(
|
| 10 |
(predicted_mask.cpu().numpy() * 255).astype(np.uint8)
|
| 11 |
).resize(image.size).convert('L')
|
|
@@ -75,12 +74,12 @@ if uploaded_file:
|
|
| 75 |
predicted_mask = get_segmentation_mask(image)
|
| 76 |
|
| 77 |
# Apply Gaussian Blur
|
| 78 |
-
sigma = st.slider("Gaussian Blur Intensity", 5, 50, 15)
|
| 79 |
-
blurred_image = apply_gaussian_blur(image, predicted_mask
|
| 80 |
st.image(blurred_image, caption="Gaussian Blurred Image", use_container_width=True)
|
| 81 |
|
| 82 |
# Perform lens blur
|
| 83 |
-
st.write("Calculating depth and applying lens blur...")
|
| 84 |
with st.spinner("Applying lens blur... This might take a few moments."):
|
| 85 |
depth_array = get_depth_mask(image)
|
| 86 |
lens_blurred_img = add_depth_based_blur(depth_array, image)
|
|
|
|
| 5 |
|
| 6 |
# Function to apply Gaussian Blur
|
| 7 |
def apply_gaussian_blur(image, predicted_mask, sigma=15):
|
|
|
|
| 8 |
mask = Image.fromarray(
|
| 9 |
(predicted_mask.cpu().numpy() * 255).astype(np.uint8)
|
| 10 |
).resize(image.size).convert('L')
|
|
|
|
| 74 |
predicted_mask = get_segmentation_mask(image)
|
| 75 |
|
| 76 |
# Apply Gaussian Blur
|
| 77 |
+
# sigma = st.slider("Gaussian Blur Intensity", 5, 50, 15)
|
| 78 |
+
blurred_image = apply_gaussian_blur(image, predicted_mask)
|
| 79 |
st.image(blurred_image, caption="Gaussian Blurred Image", use_container_width=True)
|
| 80 |
|
| 81 |
# Perform lens blur
|
| 82 |
+
# st.write("Calculating depth and applying lens blur...")
|
| 83 |
with st.spinner("Applying lens blur... This might take a few moments."):
|
| 84 |
depth_array = get_depth_mask(image)
|
| 85 |
lens_blurred_img = add_depth_based_blur(depth_array, image)
|