INNER CODE UNIT · Python
confidence
Niketkumardheeryan/ML-CaPsule · Alzheimer's Disease Predictor/app.py:91
confidence = float(np.max(prediction[0])) * 100
# Show result
st.markdown("## 📊 Prediction Result")
st.markdown(f"### {COLORS[predicted_class]} {LABELS[predicted_class]}")
st.progress(confidence / 100)
st.write(f"**Confidence:** {confidence:.2f}%")
st.markdown(f"> {DESCRIPTIONS[predicted_class]}")
# Show all class probabilities
st.markdown("### 📈 Class Probabilities")
for i, prob in enumerate(prediction[0]):
st.write(f"{LABELS[i]}: **{prob*100:.2f}%**")
st.progress(float(prob))
except Exception as e:
st.error(f"Error loading model: {e}")
st.warning("Make sure `alzheimer_model.h5` is in the same folder as `app.py`")