Update app.py
Browse files
app.py
CHANGED
|
@@ -111,4 +111,26 @@ if submit_button:
|
|
| 111 |
st.write(f"**Failure Probability:** {probability:.2%}")
|
| 112 |
|
| 113 |
except Exception as e:
|
| 114 |
-
st.error(f"Prediction Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
st.write(f"**Failure Probability:** {probability:.2%}")
|
| 112 |
|
| 113 |
except Exception as e:
|
| 114 |
+
st.error(f"Prediction Error: {e}")
|
| 115 |
+
# --- DEBUGGING SECTION (Paste this at the end of the submit logic) ---
|
| 116 |
+
st.divider()
|
| 117 |
+
with st.expander("🕵️♂️ View Debugging Internals (Why did it predict this?)"):
|
| 118 |
+
st.write("### 1. Raw Input Check")
|
| 119 |
+
st.write("Verify these match what you entered.")
|
| 120 |
+
st.dataframe(input_data)
|
| 121 |
+
|
| 122 |
+
st.write("### 2. Scaled Data Check")
|
| 123 |
+
st.write("⚠️ CRITICAL: If these values are huge (e.g., > 10 or < -10), your Scaler is broken.")
|
| 124 |
+
# Create a readable dataframe for scaled values
|
| 125 |
+
st.dataframe(pd.DataFrame(scaled_data, columns=EXPECTED_FEATURES))
|
| 126 |
+
|
| 127 |
+
st.write("### 3. Model Prediction Confidence")
|
| 128 |
+
st.metric(label="Failure Probability", value=f"{probability:.4f}")
|
| 129 |
+
|
| 130 |
+
st.write("### 4. System Info")
|
| 131 |
+
st.json({
|
| 132 |
+
"Model File": MODEL_FILENAME,
|
| 133 |
+
"Scaler File": SCALER_FILENAME,
|
| 134 |
+
"Input Shape": input_data.shape,
|
| 135 |
+
"sklearn_version": sklearn.__version__
|
| 136 |
+
})
|