Spaces:
Sleeping
Sleeping
Add better labels
Browse files
.DS_Store
CHANGED
|
Binary files a/.DS_Store and b/.DS_Store differ
|
|
|
app.py
CHANGED
|
@@ -100,7 +100,9 @@ def synthetic_lens_blur(img: Image.Image, max_blur_radius: int):
|
|
| 100 |
if blur_radius > 1:
|
| 101 |
blurred_roi = cv2.GaussianBlur(roi, (blur_radius, blur_radius), 0)
|
| 102 |
try:
|
| 103 |
-
blurred_image[i, j] = blurred_roi[
|
|
|
|
|
|
|
| 104 |
except:
|
| 105 |
blurred_image[i, j] = original_rgb[i, j]
|
| 106 |
else:
|
|
@@ -129,14 +131,22 @@ def update_synthetic(img, radius):
|
|
| 129 |
|
| 130 |
|
| 131 |
with gr.Blocks() as demo:
|
| 132 |
-
gr.Markdown(
|
|
|
|
|
|
|
| 133 |
|
| 134 |
with gr.Row():
|
| 135 |
image_input = gr.Image(type="pil", label="Upload Image")
|
| 136 |
|
| 137 |
with gr.Row():
|
| 138 |
g_slider = gr.Slider(1, 49, step=2, value=11, label="Gaussian Kernel Size")
|
| 139 |
-
lens_slider = gr.Slider(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
synth_slider = gr.Slider(1, 50, step=1, value=25, label="Synthetic Blur Radius")
|
| 141 |
|
| 142 |
with gr.Row():
|
|
@@ -152,8 +162,14 @@ with gr.Blocks() as demo:
|
|
| 152 |
)
|
| 153 |
|
| 154 |
# Individual updates for each slider
|
| 155 |
-
g_slider.change(
|
| 156 |
-
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
demo.launch()
|
|
|
|
| 100 |
if blur_radius > 1:
|
| 101 |
blurred_roi = cv2.GaussianBlur(roi, (blur_radius, blur_radius), 0)
|
| 102 |
try:
|
| 103 |
+
blurred_image[i, j] = blurred_roi[
|
| 104 |
+
blur_radius // 2, blur_radius // 2
|
| 105 |
+
]
|
| 106 |
except:
|
| 107 |
blurred_image[i, j] = original_rgb[i, j]
|
| 108 |
else:
|
|
|
|
| 131 |
|
| 132 |
|
| 133 |
with gr.Blocks() as demo:
|
| 134 |
+
gr.Markdown(
|
| 135 |
+
"## 🌀 Blur Effects Comparison: Gaussian, Depth-Based, Synthetic (Depth Based Blur works with bottles)"
|
| 136 |
+
)
|
| 137 |
|
| 138 |
with gr.Row():
|
| 139 |
image_input = gr.Image(type="pil", label="Upload Image")
|
| 140 |
|
| 141 |
with gr.Row():
|
| 142 |
g_slider = gr.Slider(1, 49, step=2, value=11, label="Gaussian Kernel Size")
|
| 143 |
+
lens_slider = gr.Slider(
|
| 144 |
+
1,
|
| 145 |
+
50,
|
| 146 |
+
step=1,
|
| 147 |
+
value=15,
|
| 148 |
+
label="Depth-Based Blur Intensity (Works with bottles)",
|
| 149 |
+
)
|
| 150 |
synth_slider = gr.Slider(1, 50, step=1, value=25, label="Synthetic Blur Radius")
|
| 151 |
|
| 152 |
with gr.Row():
|
|
|
|
| 162 |
)
|
| 163 |
|
| 164 |
# Individual updates for each slider
|
| 165 |
+
g_slider.change(
|
| 166 |
+
fn=update_gaussian, inputs=[image_input, g_slider], outputs=g_output
|
| 167 |
+
)
|
| 168 |
+
lens_slider.change(
|
| 169 |
+
fn=update_lens, inputs=[image_input, lens_slider], outputs=l_output
|
| 170 |
+
)
|
| 171 |
+
synth_slider.change(
|
| 172 |
+
fn=update_synthetic, inputs=[image_input, synth_slider], outputs=s_output
|
| 173 |
+
)
|
| 174 |
|
| 175 |
demo.launch()
|