Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,24 @@ def classify_potato_plant(img):
|
|
21 |
predictions = model.predict(img)
|
22 |
predicted_class = np.argmax(predictions[0])
|
23 |
confidence = predictions[0][predicted_class]
|
|
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
# Create the Gradio interface
|
29 |
interface = gr.Interface(
|
30 |
fn=classify_potato_plant,
|
31 |
inputs=gr.Image(type="pil"),
|
32 |
-
outputs=[gr.Label(num_top_classes=1), gr.Textbox(label="Confidence Score")]
|
|
|
|
|
33 |
)
|
34 |
|
35 |
# Launch the app
|
|
|
21 |
predictions = model.predict(img)
|
22 |
predicted_class = np.argmax(predictions[0])
|
23 |
confidence = predictions[0][predicted_class]
|
24 |
+
model_output = "None"
|
25 |
|
26 |
+
if class_labels[predicted_class] == "Potato__Early_blight":
|
27 |
+
model_output = "Early blight"
|
28 |
+
elif class_labels[predicted_class] == "Potato__Late_blight":
|
29 |
+
model_output = "Late blight"
|
30 |
+
elif class_labels[predicted_class] == "Potate__healthy":
|
31 |
+
model_output = "Healthy"
|
32 |
+
|
33 |
+
return model_output, confidence
|
34 |
|
35 |
# Create the Gradio interface
|
36 |
interface = gr.Interface(
|
37 |
fn=classify_potato_plant,
|
38 |
inputs=gr.Image(type="pil"),
|
39 |
+
outputs=[gr.Label(num_top_classes=1), gr.Textbox(label="Confidence Score")],
|
40 |
+
title="Acres - PPDC",
|
41 |
+
description="Acres PPDC, is our Potato Plant Disease Classification vision model, capable of accurately classifying potato plant disease, based on a single image."
|
42 |
)
|
43 |
|
44 |
# Launch the app
|