Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,7 @@
|
|
1 |
import gradio
|
2 |
import cv2
|
3 |
|
4 |
-
def greet(image, in_contrast, in_brightness):
|
5 |
-
in_contrast = float(in_contrast)
|
6 |
-
in_brightness = float(in_brightness)
|
7 |
-
# contrast [1.0-3.0]
|
8 |
-
# brightness [0-100]
|
9 |
-
# https://docs.opencv.org/4.x/d3/dc1/tutorial_basic_linear_transform.html
|
10 |
-
new_image = cv2.convertScaleAbs(image, alpha=in_contrast, beta=in_brightness)
|
11 |
|
12 |
-
# We create our gabor filters, and then apply them to our image
|
13 |
-
gfilters = create_gaborfilter()
|
14 |
-
new_image = apply_filter(new_image, gfilters)
|
15 |
-
|
16 |
-
return new_image
|
17 |
|
18 |
def create_gaborfilter():
|
19 |
# This function is designed to produce a set of GaborFilters
|
@@ -50,7 +38,19 @@ def apply_filter(img, filters):
|
|
50 |
np.maximum(newimage, image_filter, newimage)
|
51 |
return newimage
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
demo = gradio.Interface(
|
56 |
fn=greet,
|
|
|
1 |
import gradio
|
2 |
import cv2
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
def create_gaborfilter():
|
7 |
# This function is designed to produce a set of GaborFilters
|
|
|
38 |
np.maximum(newimage, image_filter, newimage)
|
39 |
return newimage
|
40 |
|
41 |
+
def greet(image, in_contrast, in_brightness):
|
42 |
+
in_contrast = float(in_contrast)
|
43 |
+
in_brightness = float(in_brightness)
|
44 |
+
# contrast [1.0-3.0]
|
45 |
+
# brightness [0-100]
|
46 |
+
# https://docs.opencv.org/4.x/d3/dc1/tutorial_basic_linear_transform.html
|
47 |
+
new_image = cv2.convertScaleAbs(image, alpha=in_contrast, beta=in_brightness)
|
48 |
|
49 |
+
# We create our gabor filters, and then apply them to our image
|
50 |
+
gfilters = create_gaborfilter()
|
51 |
+
new_image = apply_filter(new_image, gfilters)
|
52 |
+
|
53 |
+
return new_image
|
54 |
|
55 |
demo = gradio.Interface(
|
56 |
fn=greet,
|