|
import gradio |
|
import cv2 |
|
|
|
def greet(image, name, is_morning, temperature): |
|
salutation = "Good morning" if is_morning else "Good evening" |
|
greeting = f"{salutation} {name}. It is {temperature} degrees today" |
|
celsius = (temperature - 32) * 5 / 9 |
|
|
|
|
|
|
|
in_contrast = 1.0 |
|
in_brightness = 50 |
|
new_image = cv.convertScaleAbs(image, alpha=in_contrast, beta=in_brightness) |
|
return new_image, greeting, round(celsius, 2) |
|
|
|
|
|
demo = gradio.Interface( |
|
fn=greet, |
|
inputs=['image',"text", "checkbox", gradio.Slider(0, 100)], |
|
outputs=['image',"text", "number"], |
|
) |
|
demo.launch() |
|
|
|
|
|
|
|
|
|
|