Update app.py
Browse files
app.py
CHANGED
@@ -48,8 +48,6 @@ def predict_disease(image):
|
|
48 |
"""
|
49 |
Preprocesses the image, performs prediction, and returns the predicted class with confidence score.
|
50 |
"""
|
51 |
-
# Resize and preprocess image
|
52 |
-
# Resize and preprocess the image
|
53 |
img = tf.image.resize(image, [256, 256])
|
54 |
img = tf.expand_dims(img, axis=0) # Add batch dimension
|
55 |
|
@@ -60,11 +58,12 @@ def predict_disease(image):
|
|
60 |
# Create a dictionary of class probabilities
|
61 |
class_probs = {label: float(prob) for label, prob in zip(labels, prediction)}
|
62 |
|
|
|
63 |
# ... (Rest of your code) ...
|
64 |
|
65 |
iface = gr.Interface(
|
66 |
fn=predict_disease,
|
67 |
-
inputs=gr.Image(
|
68 |
outputs=gr.Label(num_top_classes=3), # Display all three probabilities
|
69 |
title="Potato Disease Classifier ππ₯",
|
70 |
description=(
|
|
|
48 |
"""
|
49 |
Preprocesses the image, performs prediction, and returns the predicted class with confidence score.
|
50 |
"""
|
|
|
|
|
51 |
img = tf.image.resize(image, [256, 256])
|
52 |
img = tf.expand_dims(img, axis=0) # Add batch dimension
|
53 |
|
|
|
58 |
# Create a dictionary of class probabilities
|
59 |
class_probs = {label: float(prob) for label, prob in zip(labels, prediction)}
|
60 |
|
61 |
+
return class_probs
|
62 |
# ... (Rest of your code) ...
|
63 |
|
64 |
iface = gr.Interface(
|
65 |
fn=predict_disease,
|
66 |
+
inputs=gr.Image(), # Allow image editing
|
67 |
outputs=gr.Label(num_top_classes=3), # Display all three probabilities
|
68 |
title="Potato Disease Classifier ππ₯",
|
69 |
description=(
|