Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
| 3 |
from tensorflow.keras.utils import img_to_array,load_img
|
| 4 |
-
from keras.models import load_model
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
# Load the pre-trained model from the local path
|
| 8 |
-
model_path = '
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def predict_disease(image_file, model, all_labels):
|
| 12 |
-
|
| 13 |
try:
|
| 14 |
# Load and preprocess the image
|
| 15 |
img = load_img(image_file, target_size=(224, 224)) # Use load_img from tensorflow.keras.utils
|
|
@@ -25,8 +38,8 @@ def predict_disease(image_file, model, all_labels):
|
|
| 25 |
predicted_label = all_labels[predicted_class]
|
| 26 |
|
| 27 |
# Print the predicted label to the console
|
| 28 |
-
|
| 29 |
-
if predicted_label=='
|
| 30 |
predicted_label = """<style>
|
| 31 |
li{
|
| 32 |
font-size: 15px;
|
|
@@ -57,21 +70,20 @@ def predict_disease(image_file, model, all_labels):
|
|
| 57 |
}
|
| 58 |
|
| 59 |
</style>
|
| 60 |
-
<h3><center><b>
|
| 61 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 62 |
<ul>
|
| 63 |
-
<li>1.
|
| 64 |
-
<li>2.
|
| 65 |
-
<li>3.
|
| 66 |
-
<li>4.
|
| 67 |
-
|
| 68 |
-
<li>6. Copper Sulfate</li>
|
| 69 |
</ul><br>
|
| 70 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 71 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 72 |
|
| 73 |
"""
|
| 74 |
-
elif predicted_label=='
|
| 75 |
predicted_label = """
|
| 76 |
<style>
|
| 77 |
li{
|
|
@@ -103,22 +115,22 @@ def predict_disease(image_file, model, all_labels):
|
|
| 103 |
}
|
| 104 |
|
| 105 |
</style>
|
| 106 |
-
<h3><center><b>
|
| 107 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 108 |
<ul>
|
| 109 |
-
<li>1.
|
| 110 |
-
<li>2.
|
| 111 |
-
<li>3.
|
| 112 |
-
<li>4.
|
| 113 |
-
<li>5.
|
| 114 |
-
|
| 115 |
</ul>
|
| 116 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 117 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 118 |
|
| 119 |
|
| 120 |
"""
|
| 121 |
-
elif predicted_label=='
|
| 122 |
predicted_label = """
|
| 123 |
<style>
|
| 124 |
li{
|
|
@@ -150,15 +162,15 @@ def predict_disease(image_file, model, all_labels):
|
|
| 150 |
}
|
| 151 |
|
| 152 |
</style>
|
| 153 |
-
<h3><center><b>
|
| 154 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 155 |
<ul>
|
| 156 |
-
<li>1.
|
| 157 |
-
<li>2.
|
| 158 |
-
<li>3.
|
| 159 |
-
<li>4.
|
| 160 |
-
|
| 161 |
-
<li>
|
| 162 |
</ul>
|
| 163 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 164 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
|
@@ -166,7 +178,7 @@ def predict_disease(image_file, model, all_labels):
|
|
| 166 |
|
| 167 |
"""
|
| 168 |
|
| 169 |
-
elif predicted_label=='
|
| 170 |
predicted_label = """
|
| 171 |
<style>
|
| 172 |
li{
|
|
@@ -198,22 +210,21 @@ def predict_disease(image_file, model, all_labels):
|
|
| 198 |
}
|
| 199 |
|
| 200 |
</style>
|
| 201 |
-
<h3><center><b>
|
| 202 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 203 |
<ul>
|
| 204 |
-
<li>1.
|
| 205 |
-
<li>2.
|
| 206 |
-
<li>3.
|
| 207 |
-
<li>4.
|
| 208 |
-
<li>5.
|
| 209 |
-
<li>6. Sodium bicarbonate</li>
|
| 210 |
</ul>
|
| 211 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 212 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 213 |
|
| 214 |
|
| 215 |
"""
|
| 216 |
-
elif predicted_label=='
|
| 217 |
predicted_label = """
|
| 218 |
<style>
|
| 219 |
li{
|
|
@@ -245,22 +256,22 @@ def predict_disease(image_file, model, all_labels):
|
|
| 245 |
}
|
| 246 |
|
| 247 |
</style>
|
| 248 |
-
<h3><center><b>
|
| 249 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 250 |
<ul>
|
| 251 |
<li>1. Imidacloprid</li>
|
| 252 |
<li>2. Thiamethoxam</li>
|
| 253 |
-
<li>3.
|
| 254 |
-
<li>4.
|
| 255 |
-
<li>5.
|
| 256 |
-
|
| 257 |
</ul>
|
| 258 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 259 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 260 |
|
| 261 |
|
| 262 |
"""
|
| 263 |
-
elif predicted_label=='
|
| 264 |
predicted_label = """
|
| 265 |
<style>
|
| 266 |
li{
|
|
@@ -292,15 +303,14 @@ def predict_disease(image_file, model, all_labels):
|
|
| 292 |
}
|
| 293 |
|
| 294 |
</style>
|
| 295 |
-
<h3><center><b>
|
| 296 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 297 |
<ul>
|
| 298 |
-
<li>1.
|
| 299 |
-
<li>2.
|
| 300 |
-
<li>3.
|
| 301 |
-
<li>4.
|
| 302 |
<li>5. Propiconazole</li>
|
| 303 |
-
<li>6. Azoxystrobin</li>
|
| 304 |
</ul>
|
| 305 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 306 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
|
@@ -308,7 +318,7 @@ def predict_disease(image_file, model, all_labels):
|
|
| 308 |
|
| 309 |
"""
|
| 310 |
|
| 311 |
-
elif predicted_label=='
|
| 312 |
predicted_label = """
|
| 313 |
<style>
|
| 314 |
li{
|
|
@@ -340,13 +350,106 @@ def predict_disease(image_file, model, all_labels):
|
|
| 340 |
}
|
| 341 |
|
| 342 |
</style>
|
| 343 |
-
<h3><center><b>
|
| 344 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 345 |
<ul>
|
| 346 |
-
<li>1.
|
| 347 |
-
<li>2.
|
| 348 |
-
<li>3.
|
| 349 |
-
<li>4.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 350 |
<li>5. Insecticidal soap</li>
|
| 351 |
<li>6. Horticultural oil</li>
|
| 352 |
</ul>
|
|
@@ -355,9 +458,13 @@ def predict_disease(image_file, model, all_labels):
|
|
| 355 |
|
| 356 |
|
| 357 |
"""
|
| 358 |
-
|
| 359 |
-
|
|
|
|
|
|
|
| 360 |
<center>No need use Pesticides</center>"""
|
|
|
|
|
|
|
| 361 |
|
| 362 |
return predicted_label
|
| 363 |
|
|
@@ -368,14 +475,16 @@ def predict_disease(image_file, model, all_labels):
|
|
| 368 |
|
| 369 |
# List of class labels
|
| 370 |
all_labels = [
|
| 371 |
-
'
|
| 372 |
-
'
|
| 373 |
-
'
|
| 374 |
-
'
|
| 375 |
-
'
|
| 376 |
-
'
|
| 377 |
-
'
|
| 378 |
-
'
|
|
|
|
|
|
|
| 379 |
]
|
| 380 |
|
| 381 |
# Define the Gradio interface
|
|
@@ -387,9 +496,10 @@ gr_interface = gr.Interface(
|
|
| 387 |
fn=gradio_predict, # Function to call for predictions
|
| 388 |
inputs=gr.Image(type="filepath"), # Upload image as file path
|
| 389 |
outputs="html", # Output will be the class label as text
|
| 390 |
-
title="
|
| 391 |
description="Upload an image of a plant to predict the disease.",
|
| 392 |
)
|
| 393 |
|
| 394 |
# Launch the Gradio app
|
|
|
|
| 395 |
gr_interface.launch(share=True)
|
|
|
|
| 1 |
+
!pip install tensorflow==2.11.0
|
| 2 |
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# Import tensorflow here
|
| 5 |
+
import tensorflow as tf
|
| 6 |
+
|
| 7 |
from tensorflow.keras.utils import img_to_array,load_img
|
| 8 |
+
from tensorflow.keras.models import load_model # Use tensorflow.keras.models
|
| 9 |
import numpy as np
|
| 10 |
|
| 11 |
# Load the pre-trained model from the local path
|
| 12 |
+
model_path = '/content/tomato.h5'
|
| 13 |
+
|
| 14 |
+
# Define custom objects to handle potential incompatibilities
|
| 15 |
+
custom_objects = {'DepthwiseConv2D': tf.keras.layers.DepthwiseConv2D}
|
| 16 |
+
|
| 17 |
+
# Load the model with custom_objects
|
| 18 |
+
model = load_model(model_path, custom_objects=custom_objects)
|
| 19 |
+
|
| 20 |
+
# ... (rest of your code)
|
| 21 |
+
|
| 22 |
+
# ... (rest of your code) # Load the model here
|
| 23 |
|
| 24 |
def predict_disease(image_file, model, all_labels):
|
| 25 |
+
|
| 26 |
try:
|
| 27 |
# Load and preprocess the image
|
| 28 |
img = load_img(image_file, target_size=(224, 224)) # Use load_img from tensorflow.keras.utils
|
|
|
|
| 38 |
predicted_label = all_labels[predicted_class]
|
| 39 |
|
| 40 |
# Print the predicted label to the console
|
| 41 |
+
|
| 42 |
+
if predicted_label=='Tomato Yellow Leaf Curl Virus':
|
| 43 |
predicted_label = """<style>
|
| 44 |
li{
|
| 45 |
font-size: 15px;
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
</style>
|
| 73 |
+
<h3><center><b>Tomato Yellow Leaf Curl Virus</b></center></h3>
|
| 74 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 75 |
<ul>
|
| 76 |
+
<li>1. imidacloprid</li>
|
| 77 |
+
<li>2. thiamethoxam</li>
|
| 78 |
+
<li>3. Spinosad</li>
|
| 79 |
+
<li>4. Acetamiprid</li>
|
| 80 |
+
|
|
|
|
| 81 |
</ul><br>
|
| 82 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 83 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 84 |
|
| 85 |
"""
|
| 86 |
+
elif predicted_label=='Tomato Target Spot':
|
| 87 |
predicted_label = """
|
| 88 |
<style>
|
| 89 |
li{
|
|
|
|
| 115 |
}
|
| 116 |
|
| 117 |
</style>
|
| 118 |
+
<h3><center><b>Tomato Target Spot</b></center></h3>
|
| 119 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 120 |
<ul>
|
| 121 |
+
<li>1. Azoxystrobin</li>
|
| 122 |
+
<li>2. Boscalid</li>
|
| 123 |
+
<li>3. Mancozeb</li>
|
| 124 |
+
<li>4. Chlorothalonil</li>
|
| 125 |
+
<li>5. Propiconazole</li>
|
| 126 |
+
|
| 127 |
</ul>
|
| 128 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 129 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 130 |
|
| 131 |
|
| 132 |
"""
|
| 133 |
+
elif predicted_label=='Tomato Spider mites':
|
| 134 |
predicted_label = """
|
| 135 |
<style>
|
| 136 |
li{
|
|
|
|
| 162 |
}
|
| 163 |
|
| 164 |
</style>
|
| 165 |
+
<h3><center><b>Tomato Spider mites</b></center></h3>
|
| 166 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 167 |
<ul>
|
| 168 |
+
<li>1. Abamectin</li>
|
| 169 |
+
<li>2. Spiromesifen</li>
|
| 170 |
+
<li>3. Miticides</li>
|
| 171 |
+
<li>4. insecticidal soap</li>
|
| 172 |
+
|
| 173 |
+
<li>5. Neem oil</li>
|
| 174 |
</ul>
|
| 175 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 176 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
|
|
|
| 178 |
|
| 179 |
"""
|
| 180 |
|
| 181 |
+
elif predicted_label=='Tomato Septoria leaf spot':
|
| 182 |
predicted_label = """
|
| 183 |
<style>
|
| 184 |
li{
|
|
|
|
| 210 |
}
|
| 211 |
|
| 212 |
</style>
|
| 213 |
+
<h3><center><b>Tomato Septoria leaf spot</b></center></h3>
|
| 214 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 215 |
<ul>
|
| 216 |
+
<li>1. Azoxystrobin</li>
|
| 217 |
+
<li>2. Boscalid</li>
|
| 218 |
+
<li>3. Mancozeb</li>
|
| 219 |
+
<li>4. Chlorothalonil</li>
|
| 220 |
+
<li>5. Propiconazole</li>
|
|
|
|
| 221 |
</ul>
|
| 222 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 223 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 224 |
|
| 225 |
|
| 226 |
"""
|
| 227 |
+
elif predicted_label=='Tomato Mosaic virus':
|
| 228 |
predicted_label = """
|
| 229 |
<style>
|
| 230 |
li{
|
|
|
|
| 256 |
}
|
| 257 |
|
| 258 |
</style>
|
| 259 |
+
<h3><center><b>Tomato Mosaic virus</b></center></h3>
|
| 260 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 261 |
<ul>
|
| 262 |
<li>1. Imidacloprid</li>
|
| 263 |
<li>2. Thiamethoxam</li>
|
| 264 |
+
<li>3. Acetamiprid</li>
|
| 265 |
+
<li>4. Dinotefuran</li>
|
| 266 |
+
<li>5. Pyrethrin</li>
|
| 267 |
+
|
| 268 |
</ul>
|
| 269 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 270 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 271 |
|
| 272 |
|
| 273 |
"""
|
| 274 |
+
elif predicted_label=='Tomato Leaf Mold':
|
| 275 |
predicted_label = """
|
| 276 |
<style>
|
| 277 |
li{
|
|
|
|
| 303 |
}
|
| 304 |
|
| 305 |
</style>
|
| 306 |
+
<h3><center><b>Tomato Leaf Mold</b></center></h3>
|
| 307 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 308 |
<ul>
|
| 309 |
+
<li>1. Azoxystrobin</li>
|
| 310 |
+
<li>2. Boscalid</li>
|
| 311 |
+
<li>3. Mancozeb</li>
|
| 312 |
+
<li>4. Chlorothalonil</li>
|
| 313 |
<li>5. Propiconazole</li>
|
|
|
|
| 314 |
</ul>
|
| 315 |
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 316 |
<p>Be sure to follow local regulations and guidelines for application</p>
|
|
|
|
| 318 |
|
| 319 |
"""
|
| 320 |
|
| 321 |
+
elif predicted_label=='Tomato Late blight':
|
| 322 |
predicted_label = """
|
| 323 |
<style>
|
| 324 |
li{
|
|
|
|
| 350 |
}
|
| 351 |
|
| 352 |
</style>
|
| 353 |
+
<h3><center><b>Tomato blight</b></center></h3>
|
| 354 |
<h4>PESTICIDES TO BE USED:</h4>
|
| 355 |
<ul>
|
| 356 |
+
<li>1. metalaxl</li>
|
| 357 |
+
<li>2. Chlorothalonil</li>
|
| 358 |
+
<li>3. Mancozeb</li>
|
| 359 |
+
<li>4. Copper oxychloride</li>
|
| 360 |
+
<li>5. Azoxystrobin</li>
|
| 361 |
+
|
| 362 |
+
</ul>
|
| 363 |
+
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 364 |
+
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
"""
|
| 368 |
+
elif predicted_label=='Tomato Early blight':
|
| 369 |
+
predicted_label = """
|
| 370 |
+
<style>
|
| 371 |
+
li{
|
| 372 |
+
font-size: 15px;
|
| 373 |
+
margin-left: 90px;
|
| 374 |
+
margin-top: 15px;
|
| 375 |
+
margin-bottom: 15px;
|
| 376 |
+
}
|
| 377 |
+
h4{
|
| 378 |
+
font-size: 17px;
|
| 379 |
+
margin-top: 15px;
|
| 380 |
+
}
|
| 381 |
+
h4:hover{
|
| 382 |
+
cursor: pointer;
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
h3:hover{
|
| 386 |
+
cursor: pointer;
|
| 387 |
+
color: blue;
|
| 388 |
+
transform: scale(1.3);
|
| 389 |
+
}
|
| 390 |
+
.note{
|
| 391 |
+
text-align: center;
|
| 392 |
+
font-size: 16px;
|
| 393 |
+
}
|
| 394 |
+
p{
|
| 395 |
+
font-size: 13px;
|
| 396 |
+
text-align: center;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
</style>
|
| 400 |
+
<h3><center><b>Tomato blight</b></center></h3>
|
| 401 |
+
<h4>PESTICIDES TO BE USED:</h4>
|
| 402 |
+
<ul>
|
| 403 |
+
<li>1. Azoxystrobin</li>
|
| 404 |
+
<li>2. Boscalid</li>
|
| 405 |
+
<li>3. Mancozeb</li>
|
| 406 |
+
<li>4. Chlorothalonil</li>
|
| 407 |
+
<li>5. Propiconazole</li>
|
| 408 |
+
</ul>
|
| 409 |
+
<p class="note"><b>* * * IMPORTANT NOTE * * *</b></p>
|
| 410 |
+
<p>Be sure to follow local regulations and guidelines for application</p>
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
"""
|
| 414 |
+
elif predicted_label=='Tomato Bacterial spot':
|
| 415 |
+
predicted_label = """
|
| 416 |
+
<style>
|
| 417 |
+
li{
|
| 418 |
+
font-size: 15px;
|
| 419 |
+
margin-left: 90px;
|
| 420 |
+
margin-top: 15px;
|
| 421 |
+
margin-bottom: 15px;
|
| 422 |
+
}
|
| 423 |
+
h4{
|
| 424 |
+
font-size: 17px;
|
| 425 |
+
margin-top: 15px;
|
| 426 |
+
}
|
| 427 |
+
h4:hover{
|
| 428 |
+
cursor: pointer;
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
h3:hover{
|
| 432 |
+
cursor: pointer;
|
| 433 |
+
color: blue;
|
| 434 |
+
transform: scale(1.3);
|
| 435 |
+
}
|
| 436 |
+
.note{
|
| 437 |
+
text-align: center;
|
| 438 |
+
font-size: 16px;
|
| 439 |
+
}
|
| 440 |
+
p{
|
| 441 |
+
font-size: 13px;
|
| 442 |
+
text-align: center;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
</style>
|
| 446 |
+
<h3><center><b>Tomato Bacterial spot</b></center></h3>
|
| 447 |
+
<h4>PESTICIDES TO BE USED:</h4>
|
| 448 |
+
<ul>
|
| 449 |
+
<li>1. Copper oxychloride</li>
|
| 450 |
+
<li>2. Streptomycin</li>
|
| 451 |
+
<li>3. tetracycline</li>
|
| 452 |
+
<li>4. Oxytetracline(Terramycin)</li>
|
| 453 |
<li>5. Insecticidal soap</li>
|
| 454 |
<li>6. Horticultural oil</li>
|
| 455 |
</ul>
|
|
|
|
| 458 |
|
| 459 |
|
| 460 |
"""
|
| 461 |
+
|
| 462 |
+
elif predicted_label=='Tomato Healthy':
|
| 463 |
+
|
| 464 |
+
predicted_label = """<h3 align="center">Tomato Healthy</h3><br><br>
|
| 465 |
<center>No need use Pesticides</center>"""
|
| 466 |
+
else:
|
| 467 |
+
predict_label="choose correct image"
|
| 468 |
|
| 469 |
return predicted_label
|
| 470 |
|
|
|
|
| 475 |
|
| 476 |
# List of class labels
|
| 477 |
all_labels = [
|
| 478 |
+
'Tomato Yellow Leaf Curl Virus',
|
| 479 |
+
'Tomato Target Spot',
|
| 480 |
+
'Tomato Spider mites',
|
| 481 |
+
'Tomato Septoria leaf spot',
|
| 482 |
+
'Tomato Mosaic virus',
|
| 483 |
+
'Tomato Leaf Mold',
|
| 484 |
+
'Tomato Late blight',
|
| 485 |
+
'Tomato Healthy',
|
| 486 |
+
'Tomato Early blight',
|
| 487 |
+
'Tomato Bacterial spot'
|
| 488 |
]
|
| 489 |
|
| 490 |
# Define the Gradio interface
|
|
|
|
| 496 |
fn=gradio_predict, # Function to call for predictions
|
| 497 |
inputs=gr.Image(type="filepath"), # Upload image as file path
|
| 498 |
outputs="html", # Output will be the class label as text
|
| 499 |
+
title="Tomato Disease Predictor",
|
| 500 |
description="Upload an image of a plant to predict the disease.",
|
| 501 |
)
|
| 502 |
|
| 503 |
# Launch the Gradio app
|
| 504 |
+
|
| 505 |
gr_interface.launch(share=True)
|