Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -25,13 +25,13 @@ rot_speed = st.number_input("Rotational Speed (RPM)", min_value=0, max_value=300
|
|
| 25 |
torque = st.number_input("Torque (Nm)", min_value=0.0, max_value=100.0, value=40.0, step=0.1)
|
| 26 |
tool_wear = st.number_input("Tool Wear (min)", min_value=0, max_value=300, value=10)
|
| 27 |
|
| 28 |
-
# Assemble input into DataFrame
|
| 29 |
input_data = pd.DataFrame([{
|
| 30 |
-
'
|
| 31 |
-
'
|
| 32 |
-
'
|
| 33 |
'Torque': torque,
|
| 34 |
-
'
|
| 35 |
'Type': Type
|
| 36 |
}])
|
| 37 |
|
|
@@ -41,6 +41,11 @@ if st.button("Predict Failure"):
|
|
| 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:")
|
|
|
|
| 25 |
torque = st.number_input("Torque (Nm)", min_value=0.0, max_value=100.0, value=40.0, step=0.1)
|
| 26 |
tool_wear = st.number_input("Tool Wear (min)", min_value=0, max_value=300, value=10)
|
| 27 |
|
| 28 |
+
# Assemble input into DataFrame with correct column names
|
| 29 |
input_data = pd.DataFrame([{
|
| 30 |
+
'Air temperature': air_temp,
|
| 31 |
+
'Process temperature': process_temp,
|
| 32 |
+
'Rotational speed': rot_speed,
|
| 33 |
'Torque': torque,
|
| 34 |
+
'Tool wear': tool_wear,
|
| 35 |
'Type': Type
|
| 36 |
}])
|
| 37 |
|
|
|
|
| 41 |
# Align input columns with model training columns
|
| 42 |
input_data = input_data[model.feature_names_in_]
|
| 43 |
|
| 44 |
+
print("Model expects features:")
|
| 45 |
+
print(model.feature_names_in_)
|
| 46 |
+
print("Input data:")
|
| 47 |
+
print(input_data)
|
| 48 |
+
|
| 49 |
prediction = model.predict(input_data)[0]
|
| 50 |
result = "Machine Failure" if prediction == 1 else "No Failure"
|
| 51 |
st.subheader("Prediction Result:")
|