nehulagrawal commited on
Commit
d341b67
·
1 Parent(s): 15ed2f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -12,8 +12,15 @@ def get_predictions(img, threshold, box_color, text_color):
12
  v8_frame = yolov8_detector.plot_bboxes(v8_results, img, float(threshold), box_color, text_color)
13
  return v8_frame
14
 
15
- with gr.Blocks(title="Leaf Detection and Classification", theme=gr.themes.Monochrome()) as interface:
16
- gr.Markdown("# Leaf Detection and Classification")
 
 
 
 
 
 
 
17
  with gr.Row():
18
  with gr.Column():
19
  image = gr.Image(shape=(824, 824), label="Input Image")
@@ -29,7 +36,7 @@ with gr.Blocks(title="Leaf Detection and Classification", theme=gr.themes.Monoch
29
 
30
  with gr.Row():
31
  with gr.Box():
32
- v8_prediction = gr.Image(shape=(1024, 1024), label="YOLOv8") # Change the shape to make the output image larger
33
 
34
  btn.click(
35
  get_predictions,
@@ -40,7 +47,4 @@ with gr.Blocks(title="Leaf Detection and Classification", theme=gr.themes.Monoch
40
  with gr.Row():
41
  gr.Examples(examples=examples, inputs=[image, confidence])
42
 
43
-
44
- yolov8_detector = ObjectDetection('Yolov8')
45
-
46
  interface.launch()
 
12
  v8_frame = yolov8_detector.plot_bboxes(v8_results, img, float(threshold), box_color, text_color)
13
  return v8_frame
14
 
15
+ # Load the YOLOv8 model for plant leaf detection and classification
16
+ yolov8_detector = ObjectDetection('Yolov8')
17
+
18
+ with gr.Blocks(title="Plant Leaf Detection and Classification", theme=gr.themes.DarkMode()) as interface:
19
+ # Add a header with a description of the app and the model used
20
+ gr.Markdown("# Plant Leaf Detection and Classification")
21
+ gr.Markdown("This app uses YOLOv8, a state-of-the-art object detection model, to detect and classify plant leaves. "
22
+ "The model can detect leaves and classify them into up to 45 different plant categories.")
23
+
24
  with gr.Row():
25
  with gr.Column():
26
  image = gr.Image(shape=(824, 824), label="Input Image")
 
36
 
37
  with gr.Row():
38
  with gr.Box():
39
+ v8_prediction = gr.Image(label="YOLOv8 Prediction") # Display the output image in its original size
40
 
41
  btn.click(
42
  get_predictions,
 
47
  with gr.Row():
48
  gr.Examples(examples=examples, inputs=[image, confidence])
49
 
 
 
 
50
  interface.launch()