Update app.py
Browse files
app.py
CHANGED
|
@@ -19,16 +19,13 @@ def img_pred(upload):
|
|
| 19 |
confidence = predictions[predicted_class] # Confidence of the predicted class
|
| 20 |
|
| 21 |
# Determine if tumor is present
|
| 22 |
-
if
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
result = "No Tumor"
|
| 25 |
else:
|
| 26 |
-
result="Tumor Detected"
|
| 27 |
-
else:
|
| 28 |
-
if confidence>0.20:
|
| 29 |
result = "Tumor Detected"
|
| 30 |
-
else:
|
| 31 |
-
result = "No Tumor"
|
| 32 |
|
| 33 |
# Return result with confidence
|
| 34 |
return f"The Model predicts: {result} with a confidence of {confidence:.2%}"
|
|
|
|
| 19 |
confidence = predictions[predicted_class] # Confidence of the predicted class
|
| 20 |
|
| 21 |
# Determine if tumor is present
|
| 22 |
+
if confidence < 0.20:
|
| 23 |
+
result = "Uncertain"
|
| 24 |
+
else:
|
| 25 |
+
if predicted_class == 1: # Assuming '1' is 'No Tumor'
|
| 26 |
result = "No Tumor"
|
| 27 |
else:
|
|
|
|
|
|
|
|
|
|
| 28 |
result = "Tumor Detected"
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Return result with confidence
|
| 31 |
return f"The Model predicts: {result} with a confidence of {confidence:.2%}"
|