Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -37,7 +37,15 @@ input_data = pd.DataFrame([{
|
|
| 37 |
|
| 38 |
|
| 39 |
if st.button("Predict Failure"):
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |
if st.button("Predict Failure"):
|
| 40 |
+
try:
|
| 41 |
+
# Align input columns with model training columns
|
| 42 |
+
input_data = input_data[model.feature_names_in_]
|
| 43 |
+
|
| 44 |
+
prediction = model.predict(input_data)[0]
|
| 45 |
+
result = "Machine Failure" if prediction == 1 else "No Failure"
|
| 46 |
+
st.subheader("Prediction Result:")
|
| 47 |
+
st.success(f"The model predicts: **{result}**")
|
| 48 |
+
|
| 49 |
+
except Exception as e:
|
| 50 |
+
st.error("⚠️ An error occurred during prediction.")
|
| 51 |
+
st.exception(e)
|