Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,24 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from crop_health_monitor.inference.inference import load_disease_pipeline, diagnose
|
3 |
|
|
|
|
|
|
|
4 |
# load your published model or local checkpoint
|
5 |
pipe = load_disease_pipeline("CZerion/crop_health_monitor")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface = gr.Interface(
|
8 |
fn=lambda img: diagnose(img, pipe),
|
9 |
inputs=gr.Image(type="pil", label="Upload Leaf Image"),
|
@@ -12,7 +27,9 @@ iface = gr.Interface(
|
|
12 |
gr.Textbox(label="Care Advice")
|
13 |
],
|
14 |
title="Plant Disease Monitor",
|
15 |
-
description="Upload a crop leaf photo to detect diseases using a fine-tuned model."
|
|
|
|
|
16 |
)
|
17 |
|
18 |
if __name__ == "__main__":
|
|
|
1 |
+
import os
|
2 |
import gradio as gr
|
3 |
from crop_health_monitor.inference.inference import load_disease_pipeline, diagnose
|
4 |
|
5 |
+
"""
|
6 |
+
Step 5: Gradio demo for disease-only model with example images
|
7 |
+
"""
|
8 |
# load your published model or local checkpoint
|
9 |
pipe = load_disease_pipeline("CZerion/crop_health_monitor")
|
10 |
|
11 |
+
# Path to examples folder
|
12 |
+
examples = [
|
13 |
+
["Plants/Unhealthy_crop_1.jpg"],
|
14 |
+
["Plants/Unhealthy_crop_2.jpg"],
|
15 |
+
["Plants/Unhealthy_crop_3.jpg"],
|
16 |
+
["Plants/Unhealthy_crop_4.jpg"],
|
17 |
+
["Plants/Unhealthy_crop_5.jpg"],
|
18 |
+
["Plants/Healthy_crop_1.jpg"],
|
19 |
+
["Plants/Healthy_crop_2.jpg"]
|
20 |
+
]
|
21 |
+
|
22 |
iface = gr.Interface(
|
23 |
fn=lambda img: diagnose(img, pipe),
|
24 |
inputs=gr.Image(type="pil", label="Upload Leaf Image"),
|
|
|
27 |
gr.Textbox(label="Care Advice")
|
28 |
],
|
29 |
title="Plant Disease Monitor",
|
30 |
+
description="Upload a crop leaf photo to detect diseases using a fine-tuned model.",
|
31 |
+
examples=examples,
|
32 |
+
allow_flagging="never"
|
33 |
)
|
34 |
|
35 |
if __name__ == "__main__":
|