SarowarSaurav commited on
Commit
29b03e2
·
verified ·
1 Parent(s): 744ed2f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -4,9 +4,8 @@ from PIL import Image
4
  import numpy as np
5
  import cv2
6
 
7
- # This should download the model if not available locally
8
- model = YOLO('yolov8n.pt') # Using a YOLOv8 model which is often smaller and compatible
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.inputs.Image(type="pil"),
48
  outputs=[
49
- gr.outputs.Image(type="pil", label="Annotated Image"),
50
- gr.outputs.Dataframe(headers=["Disease", "Confidence"], label="Predictions")
51
  ],
52
- title="Leaf Disease Identifier with YOLOv5",
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