| import gradio as gr |
| from PIL import Image, ImageEnhance |
|
|
| |
| def process_image(image, brightness): |
| |
| grayscale_image = image.convert("L") |
| |
| |
| enhancer = ImageEnhance.Brightness(grayscale_image) |
| bright_image = enhancer.enhance(brightness) |
| |
| return bright_image |
|
|
| |
| iface = gr.Interface( |
| fn=process_image, |
| inputs=[ |
| gr.Image(type="pil"), |
| gr.Slider(0.1, 2.0, 1.0, label="Brightness") |
| ], |
| outputs="image", |
| title="Grayscale Image Processor", |
| description="Upload an image, convert it to grayscale, and adjust the brightness." |
| ) |
|
|
| |
| iface.launch() |
|
|