fahimehorvatinia's picture
Create app.py
3834351 unverified
raw
history blame
965 Bytes
import gradio as gr
from PIL import Image, ImageOps
def demo_process(image):
"""Simple placeholder:
- returns original
- grayscale version
- inverted colors
"""
if image is None:
return []
# Original
original = image
# Grayscale
gray = ImageOps.grayscale(image)
# Invert
inverted = ImageOps.invert(image.convert("RGB"))
return [original, gray, inverted]
# Build Gradio UI
with gr.Blocks(theme=gr.themes.Soft()) as demo:
gr.Markdown("# 🌿 Plant Analysis Demo\nUpload an image and see example outputs.")
with gr.Row():
with gr.Column(scale=1):
inp = gr.Image(type="pil", label="Upload Image")
run = gr.Button("Run Demo", variant="primary")
with gr.Column(scale=2):
gallery = gr.Gallery(label="Outputs").style(grid=[3], height="auto")
run.click(demo_process, inputs=inp, outputs=gallery)
if __name__ == "__main__":
demo.launch()