Spaces:
Runtime error
Runtime error
Commit
·
d869637
1
Parent(s):
3ef24f4
Update app.py
Browse files
app.py
CHANGED
@@ -17,13 +17,12 @@ def predict(image):
|
|
17 |
# Get the predicted class label
|
18 |
if prediction[0][0] < 0.5:
|
19 |
label = 'Benign'
|
|
|
20 |
else:
|
21 |
label = 'Malignant'
|
|
|
22 |
|
23 |
-
|
24 |
-
sigmoid_percentage = f"{prediction[0][0] * 100:.2f}%"
|
25 |
-
|
26 |
-
return f"{label} ({sigmoid_percentage})", sigmoid_percentage
|
27 |
|
28 |
examples = [["benign.jpg"], ["malignant.jpg"]]
|
29 |
|
|
|
17 |
# Get the predicted class label
|
18 |
if prediction[0][0] < 0.5:
|
19 |
label = 'Benign'
|
20 |
+
confidence = 1 - prediction[0][0] # Confidence for benign
|
21 |
else:
|
22 |
label = 'Malignant'
|
23 |
+
confidence = prediction[0][0] # Confidence for malignant
|
24 |
|
25 |
+
return {'label': label, 'confidence': confidence}
|
|
|
|
|
|
|
26 |
|
27 |
examples = [["benign.jpg"], ["malignant.jpg"]]
|
28 |
|