INNER CODE UNIT · Python
gray
Niketkumardheeryan/ML-CaPsule · Alzheimer's Disease Predictor/app.py:83
gray = gray / 255.0
gray = cv2.resize(gray, (240, 240))
gray = gray.reshape(1, 240, 240, 1)
# Load model and predict
model = load_cnn_model()
prediction = model.predict(gray)
predicted_class = int(np.argmax(prediction[0]))
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