Update app.py
Browse files
app.py
CHANGED
@@ -24,20 +24,14 @@ def classify_image(image):
|
|
24 |
confidence = np.max(prediction[0])
|
25 |
|
26 |
if confidence < 0.6:
|
27 |
-
|
28 |
-
|
29 |
-
'confidence': confidence,
|
30 |
-
'details': "The model was unable to confidently classify the image."
|
31 |
-
}
|
32 |
else:
|
33 |
class_name = class_names[predicted_class.numpy()]
|
34 |
-
|
35 |
-
|
36 |
-
'confidence': confidence,
|
37 |
-
'details': f"The image is classified as {class_name} with a confidence of {confidence:.2f}."
|
38 |
-
}
|
39 |
|
40 |
-
return
|
41 |
|
42 |
|
43 |
iface = gr.Interface(
|
|
|
24 |
confidence = np.max(prediction[0])
|
25 |
|
26 |
if confidence < 0.6:
|
27 |
+
result = "Unable to detect"
|
28 |
+
details = "The model was unable to confidently classify the image."
|
|
|
|
|
|
|
29 |
else:
|
30 |
class_name = class_names[predicted_class.numpy()]
|
31 |
+
result = class_name
|
32 |
+
details = f"The image is classified as {class_name} with a confidence of {confidence:.2f}."
|
|
|
|
|
|
|
33 |
|
34 |
+
return result, confidence, details
|
35 |
|
36 |
|
37 |
iface = gr.Interface(
|