File size: 546 Bytes
eab34ad 15364a8 7b1d75c 42b3e91 3dc6831 71477f6 4ab77bb 2a01a01 3dc6831 9a23331 b648488 9a23331 7b1d75c 2a01a01 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 |
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)
return new_image
demo = gradio.Interface(
fn=greet,
inputs=['image', gradio.Slider(0,100), gradio.Slider(0, 100)],
outputs=['image'],
)
demo.launch()
|