narain
commited on
Commit
·
662e365
1
Parent(s):
c7fc3bf
update code
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def apply_blur(image, blur_type, blur_strength, depth_threshold):
|
|
48 |
align_corners=False,
|
49 |
)
|
50 |
|
51 |
-
mask = prediction[0, 0, :, :].detach().cpu().numpy()
|
52 |
mask = mask.astype(np.uint8)
|
53 |
|
54 |
# Invert mask using cv2
|
@@ -76,7 +76,7 @@ iface = gr.Interface(
|
|
76 |
gr.Image(label="Input Image"),
|
77 |
gr.Radio(["Gaussian", "Lens"], label="Blur Type", value="Gaussian"),
|
78 |
gr.Slider(1, 30, value=15, step=1, label="Blur Strength"),
|
79 |
-
gr.Slider(-
|
80 |
],
|
81 |
outputs=gr.Image(label="Output Image"),
|
82 |
title="Image Segmentation and Blurring",
|
|
|
48 |
align_corners=False,
|
49 |
)
|
50 |
|
51 |
+
mask = prediction[0, 0, :, :].detach().cpu().numpy() > depth_threshold
|
52 |
mask = mask.astype(np.uint8)
|
53 |
|
54 |
# Invert mask using cv2
|
|
|
76 |
gr.Image(label="Input Image"),
|
77 |
gr.Radio(["Gaussian", "Lens"], label="Blur Type", value="Gaussian"),
|
78 |
gr.Slider(1, 30, value=15, step=1, label="Blur Strength"),
|
79 |
+
gr.Slider(-20, 20, value=-4, step=0.1, label="Depth Threshold")
|
80 |
],
|
81 |
outputs=gr.Image(label="Output Image"),
|
82 |
title="Image Segmentation and Blurring",
|