fahimehorvatinia's picture
Update app.py
9226311 unverified
raw
history blame
961 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() 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):
# Removed .style() for compatibility
gallery = gr.Gallery(label="Outputs")
run.click(demo_process, inputs=inp, outputs=gallery)
if __name__ == "__main__":
demo.launch()