Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,8 @@ from PIL import Image
|
|
4 |
import numpy as np
|
5 |
import cv2
|
6 |
|
7 |
-
#
|
8 |
-
model = YOLO('yolov8n.pt') #
|
9 |
-
# Change to a leaf disease detection model if available
|
10 |
|
11 |
def identify_disease(image):
|
12 |
# Convert the image to RGB if it's not
|
@@ -41,15 +40,15 @@ def identify_disease(image):
|
|
41 |
|
42 |
return annotated_image, results_list
|
43 |
|
44 |
-
# Define Gradio interface
|
45 |
interface = gr.Interface(
|
46 |
fn=identify_disease,
|
47 |
-
inputs=gr.
|
48 |
outputs=[
|
49 |
-
gr.
|
50 |
-
gr.
|
51 |
],
|
52 |
-
title="Leaf Disease Identifier with
|
53 |
description="Upload an image of a leaf, and this tool will identify the disease with confidence scores."
|
54 |
)
|
55 |
|
|
|
4 |
import numpy as np
|
5 |
import cv2
|
6 |
|
7 |
+
# Load the YOLOv8 model (you can adjust the model path if needed)
|
8 |
+
model = YOLO('yolov8n.pt') # Ensure this path points to the correct YOLO model file
|
|
|
9 |
|
10 |
def identify_disease(image):
|
11 |
# Convert the image to RGB if it's not
|
|
|
40 |
|
41 |
return annotated_image, results_list
|
42 |
|
43 |
+
# Define Gradio interface with updated syntax
|
44 |
interface = gr.Interface(
|
45 |
fn=identify_disease,
|
46 |
+
inputs=gr.Image(type="pil"),
|
47 |
outputs=[
|
48 |
+
gr.Image(type="pil", label="Annotated Image"),
|
49 |
+
gr.Dataframe(headers=["Disease", "Confidence"], label="Predictions")
|
50 |
],
|
51 |
+
title="Leaf Disease Identifier with YOLOv8",
|
52 |
description="Upload an image of a leaf, and this tool will identify the disease with confidence scores."
|
53 |
)
|
54 |
|