File size: 965 Bytes
3834351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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()