Dricz commited on
Commit
6ae2919
·
verified ·
1 Parent(s): a78ff7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -69,13 +69,18 @@ def response2(image: gr.Image = None,image_size: gr.Slider = 640, conf_threshold
69
  text += (f"Detected {name[cl]} with confidence {round(conef,1)}% at ({xy[0]},{xy[1]})\n")
70
 
71
 
72
-
 
 
 
 
 
73
 
74
  # xywh = int(results.boxes.xywh)
75
  # x = xywh[0]
76
  # y = xywh[1]
77
 
78
- return im, text
79
 
80
 
81
  inputs = [
@@ -89,7 +94,7 @@ inputs = [
89
  ]
90
 
91
  outputs = [gr.Image( type="pil", label="Output Image"),
92
- gr.Textbox(label="Result")
93
  ]
94
 
95
  examples = [
 
69
  text += (f"Detected {name[cl]} with confidence {round(conef,1)}% at ({xy[0]},{xy[1]})\n")
70
 
71
 
72
+ if name[cl] == "Corn Rust":
73
+ solution = "Apply fungicides with active ingredients like propiconazole or tebuconazole when symptoms appear."
74
+ elif name[cl] == "Gray Leaf Spot":
75
+ solution = "Use fungicides containing strobilurins (e.g., azoxystrobin) or triazoles."
76
+ elif name[cl] == "Leaf Blight":
77
+ solution = "Treat with fungicides such as mancozeb or chlorothalonil during the early stages."
78
 
79
  # xywh = int(results.boxes.xywh)
80
  # x = xywh[0]
81
  # y = xywh[1]
82
 
83
+ return im, text, solution
84
 
85
 
86
  inputs = [
 
94
  ]
95
 
96
  outputs = [gr.Image( type="pil", label="Output Image"),
97
+ gr.Textbox(label="Result"), gr.Textbox(label="Solution")
98
  ]
99
 
100
  examples = [