lappemic commited on
Commit
7b47d12
1 Parent(s): c038f22
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -13,17 +13,19 @@ def filters(file, box_blur, blur_pool2d, gaussian_blur2d, max_blur_pool2d, media
13
 
14
  # apply tensor image enhancement
15
  x_out: Tensor = K.filters.box_blur(img, (int(box_blur), int(box_blur)))
16
- x_out = K.filters.blur_pool2d(x_out, float(blur_pool2d))
17
- x_out = K.filters.gaussian_blur2d(x_out, float(gaussian_blur2d))
18
- x_out = K.filters.max_blur_pool2d(x_out, float(max_blur_pool2d))
19
- x_out = K.filters.median_blur(x_out, (float(median_blur), float(median_blur)))
 
 
20
 
21
  return K.utils.tensor_to_image(x_out)
22
 
23
 
24
  examples = [
25
- ["examples/ninja_turtles.jpg", 0, 1, 1, 1, 0],
26
- ["examples/kitty.jpg", 0, 1, 1, 1, 0],
27
  ]
28
 
29
  title = "Kornia Image Filters"
@@ -34,11 +36,11 @@ iface = gr.Interface(
34
  filters,
35
  [
36
  gr.inputs.Image(type="file"),
37
- gr.inputs.Slider(minimum=0, maximum=10, step=1, default=0, label="Box Blur"),
38
- gr.inputs.Slider(minimum=0, maximum=10, step=1, default=1, label="Blur Pool"),
39
- gr.inputs.Slider(minimum=0, maximum=20, step=1, default=1, label="Gaussian Blur"),
40
- gr.inputs.Slider(minimum=0, maximum=1, step=0.1, default=1, label="Max Pool"),
41
- gr.inputs.Slider(minimum=0, maximum=4, step=0.1, default=0, label="Median Blur"),
42
  ],
43
  "image",
44
  examples=examples,
 
13
 
14
  # apply tensor image enhancement
15
  x_out: Tensor = K.filters.box_blur(img, (int(box_blur), int(box_blur)))
16
+ x_out = K.filters.blur_pool2d(x_out, int(blur_pool2d))
17
+ x_out = K.filters.gaussian_blur2d(x_out,
18
+ (int(gaussian_blur2d), int(gaussian_blur2d))
19
+ (float(gaussian_blur2d), float(gaussian_blur2d))
20
+ x_out = K.filters.max_blur_pool2d(x_out, int(max_blur_pool2d))
21
+ x_out = K.filters.median_blur(x_out, (int(median_blur), int(median_blur)))
22
 
23
  return K.utils.tensor_to_image(x_out)
24
 
25
 
26
  examples = [
27
+ ["examples/ninja_turtles.jpg", 1, 1, 1, 1, 1],
28
+ ["examples/kitty.jpg", 1, 1, 1, 1, 1],
29
  ]
30
 
31
  title = "Kornia Image Filters"
 
36
  filters,
37
  [
38
  gr.inputs.Image(type="file"),
39
+ gr.inputs.Slider(minimum=1, maximum=10, step=1, default=1, label="Box Blur"),
40
+ gr.inputs.Slider(minimum=1, maximum=10, step=1, default=1, label="Blur Pool"),
41
+ gr.inputs.Slider(minimum=1, maximum=21, step=2, default=1, label="Gaussian Blur"),
42
+ gr.inputs.Slider(minimum=1, maximum=20, step=1, default=1, label="Max Pool"),
43
+ gr.inputs.Slider(minimum=1, maximum=5 step=2, default=1, label="Median Blur"),
44
  ],
45
  "image",
46
  examples=examples,