File size: 653 Bytes
eab34ad
15364a8
 
7b1d75c
42b3e91
 
3dc6831
 
 
71477f6
4ab77bb
 
 
44e71ab
3dc6831
9a23331
b648488
9a23331
7b1d75c
44e71ab
9a23331
 
 
 
15364a8
a4409f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio 
import cv2

def greet(image, in_contrast, in_brightness):
    in_contrast = float(in_contrast) / 100*3
    in_brightness = float(in_brightness)
    # contrast [1.0-3.0]
    # brightness [0-100]
    # https://docs.opencv.org/4.x/d3/dc1/tutorial_basic_linear_transform.html
    new_image = cv2.convertScaleAbs(image, alpha=in_contrast, beta=in_brightness)

    cv2.imshow("Display window", new_image);
    int k = waitKey(0); // Wait for a keystroke in the window
    return new_image
    

demo = gradio.Interface(
    fn=greet,
    inputs=['image', gradio.Slider(0,100), gradio.Slider(0, 100)],
    outputs=['image'],
)
demo.launch()