Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -20,6 +20,8 @@ data.columns = (data.columns
|
|
| 20 |
.str.strip()
|
| 21 |
.str.replace(" ","_")
|
| 22 |
.str.replace(r"[^\w]","_",regex=True)
|
|
|
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
# -----------------------------
|
|
@@ -89,14 +91,14 @@ with st.form("engine_input_form"):
|
|
| 89 |
# Predict Button
|
| 90 |
# -----------------------------
|
| 91 |
if submit:
|
| 92 |
-
|
| 93 |
input_df = pd.DataFrame({
|
| 94 |
-
"
|
| 95 |
-
"
|
| 96 |
-
"
|
| 97 |
-
"
|
| 98 |
"lub_oil_temp": [lub_oil_temp],
|
| 99 |
-
"
|
| 100 |
})
|
| 101 |
|
| 102 |
st.success("✅ Input captured successfully")
|
|
@@ -115,7 +117,7 @@ if submit:
|
|
| 115 |
else:
|
| 116 |
label="Normal"
|
| 117 |
st.success(f"Engine working normal. Probability: {prob:.2f}")
|
| 118 |
-
|
| 119 |
# Save prediction to dataframe
|
| 120 |
input_df['Engine_condition'] = label #'Normal / Preventive maintenance req '
|
| 121 |
st.session_state['input_df'] = input_df
|
|
@@ -138,7 +140,7 @@ if submit:
|
|
| 138 |
updated_df.to_csv(file_path, index=False)
|
| 139 |
|
| 140 |
st.success("Record saved successfully!")
|
| 141 |
-
|
| 142 |
else:
|
| 143 |
st.error("Record not saved...Thank for analysis")
|
| 144 |
-
|
|
|
|
| 20 |
.str.strip()
|
| 21 |
.str.replace(" ","_")
|
| 22 |
.str.replace(r"[^\w]","_",regex=True)
|
| 23 |
+
.str.lower()
|
| 24 |
+
|
| 25 |
)
|
| 26 |
|
| 27 |
# -----------------------------
|
|
|
|
| 91 |
# Predict Button
|
| 92 |
# -----------------------------
|
| 93 |
if submit:
|
| 94 |
+
|
| 95 |
input_df = pd.DataFrame({
|
| 96 |
+
"engine_rpm": [engine_rpm],
|
| 97 |
+
"lub_oil_pressure": [lub_oil_pressure],
|
| 98 |
+
"fuel_pressure": [fuel_pressure],
|
| 99 |
+
"coolant_pressure": [coolant_pressure],
|
| 100 |
"lub_oil_temp": [lub_oil_temp],
|
| 101 |
+
"coolant_temp": [coolant_temp]
|
| 102 |
})
|
| 103 |
|
| 104 |
st.success("✅ Input captured successfully")
|
|
|
|
| 117 |
else:
|
| 118 |
label="Normal"
|
| 119 |
st.success(f"Engine working normal. Probability: {prob:.2f}")
|
| 120 |
+
|
| 121 |
# Save prediction to dataframe
|
| 122 |
input_df['Engine_condition'] = label #'Normal / Preventive maintenance req '
|
| 123 |
st.session_state['input_df'] = input_df
|
|
|
|
| 140 |
updated_df.to_csv(file_path, index=False)
|
| 141 |
|
| 142 |
st.success("Record saved successfully!")
|
| 143 |
+
|
| 144 |
else:
|
| 145 |
st.error("Record not saved...Thank for analysis")
|
| 146 |
+
|