Spaces:
Running
Running
File size: 1,067 Bytes
aeef057 dc9f5c9 f57ebbb dc9f5c9 aeef057 b4b4573 4994fc9 176b45c aeef057 dc9f5c9 b4b4573 dc9f5c9 176b45c dc9f5c9 b4b4573 aeef057 dc9f5c9 b4b4573 |
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 |
import os
import gradio as gr
from inference.inference import load_disease_pipeline, diagnose
"""
Step 5: Gradio demo for disease-only model with example images
"""
# load your published model or local checkpoint
pipe = load_disease_pipeline("linkanjarad/mobilenet_v2_1.0_224-plant-disease-identification")
# Path to examples folder
examples = [
["Plants/Unhealthy_crop_1.jpg"],
["Plants/Unhealthy_crop_2.jpg"],
["Plants/Unhealthy_crop_3.jpg"],
["Plants/Unhealthy_crop_4.jpg"],
["Plants/Unhealthy_crop_5.jpg"],
["Plants/Healthy_crop_1.jpg"],
["Plants/Healthy_crop_2.jpg"]
]
iface = gr.Interface(
fn=lambda img: diagnose(img, pipe),
inputs=gr.Image(type="pil", label="Upload Leaf Image"),
outputs=[
gr.Textbox(label="Disease Predictions (Top 3)"),
gr.Textbox(label="Care Advice")
],
title="Plant Disease Monitor",
description="Upload a crop leaf photo to detect diseases using a fine-tuned model.",
examples=examples,
allow_flagging="never"
)
if __name__ == "__main__":
iface.launch() |