Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -9,52 +9,28 @@ model_path = hf_hub_download(repo_id="jarpan03/engine-predictive-maintenance-mod
|
|
| 9 |
# Load the model
|
| 10 |
model = joblib.load(model_path)
|
| 11 |
|
| 12 |
-
# Streamlit UI for
|
| 13 |
-
st.title("
|
| 14 |
-
st.write("Fill the
|
| 15 |
|
| 16 |
# Collect user input
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
NumberOfPersonVisiting = st.slider("Number of Persons Visiting", 1, 5, 2)
|
| 24 |
-
NumberOfFollowups = st.slider("Number of Follow-ups", 1, 10, 3)
|
| 25 |
-
ProductPitched = st.selectbox("Product Pitched", ["Basic", "Standard", "Deluxe", "Super Deluxe", "King"])
|
| 26 |
-
PreferredPropertyStar = st.selectbox("Preferred Property Star", [1, 2, 3, 4, 5])
|
| 27 |
-
MaritalStatus = st.selectbox("Marital Status", ["Married", "Single", "Divorced", "Unmarried"])
|
| 28 |
-
NumberOfTrips = st.slider("Number of Trips", 1, 20, 3)
|
| 29 |
-
Passport = st.selectbox("Has Passport?", ["Yes", "No"])
|
| 30 |
-
PitchSatisfactionScore = st.slider("Pitch Satisfaction Score", 1, 5, 3)
|
| 31 |
-
OwnCar = st.selectbox("Owns a Car?", ["Yes", "No"])
|
| 32 |
-
NumberOfChildrenVisiting = st.slider("Number of Children Visited", 0, 5, 1)
|
| 33 |
-
Designation = st.selectbox("Designation", ["Executive", "Manager", "AVP", "VP", "Sr. Manager"])
|
| 34 |
-
MonthlyIncome = st.number_input("Monthly Income", min_value=1000.0, value=30000.0)
|
| 35 |
|
| 36 |
# ----------------------------
|
| 37 |
# Prepare input data
|
| 38 |
# ----------------------------
|
| 39 |
input_data = pd.DataFrame([{
|
| 40 |
-
'
|
| 41 |
-
'
|
| 42 |
-
'
|
| 43 |
-
'
|
| 44 |
-
'
|
| 45 |
-
'
|
| 46 |
-
'NumberOfPersonVisiting': NumberOfPersonVisiting,
|
| 47 |
-
'NumberOfFollowups': NumberOfFollowups,
|
| 48 |
-
'ProductPitched': ProductPitched,
|
| 49 |
-
'PreferredPropertyStar': PreferredPropertyStar,
|
| 50 |
-
'MaritalStatus': MaritalStatus,
|
| 51 |
-
'NumberOfTrips': NumberOfTrips,
|
| 52 |
-
'Passport': 1 if Passport == "Yes" else 0,
|
| 53 |
-
'PitchSatisfactionScore': PitchSatisfactionScore,
|
| 54 |
-
'OwnCar': 1 if OwnCar == "Yes" else 0,
|
| 55 |
-
'NumberOfChildrenVisitings': NumberOfChildrenVisiting,
|
| 56 |
-
'Designation': Designation,
|
| 57 |
-
'MonthlyIncome': MonthlyIncome
|
| 58 |
}])
|
| 59 |
|
| 60 |
# Set the classification threshold
|
|
@@ -64,5 +40,5 @@ classification_threshold = 0.45
|
|
| 64 |
if st.button("Predict"):
|
| 65 |
prob = model.predict_proba(input_data)[0,1]
|
| 66 |
pred = int(prob >= classification_threshold)
|
| 67 |
-
result = "will
|
| 68 |
-
st.write(f"Prediction:
|
|
|
|
| 9 |
# Load the model
|
| 10 |
model = joblib.load(model_path)
|
| 11 |
|
| 12 |
+
# Streamlit UI for Predictive Maintenance Prediction
|
| 13 |
+
st.title("Engine Predictive Maintenance Prediction")
|
| 14 |
+
st.write("Fill the engine details below to predict if they'll need a maintenance")
|
| 15 |
|
| 16 |
# Collect user input
|
| 17 |
+
Engine_RPM = st.number_input("Engine_RPM", min_value=1000.0, value=30000.0)
|
| 18 |
+
Lub_Oil_Pressure = st.number_input("Lub_Oil_Pressure", min_value=1000.0, value=30000.0,step=0.0000000001,format="%.10f")
|
| 19 |
+
Fuel_Pressure = st.number_input("Fuel_Pressure", min_value=1000.0, value=30000.0)
|
| 20 |
+
Coolant_Pressure = st.number_input("Coolant_Pressure", min_value=1000.0, value=30000.0)
|
| 21 |
+
Lub_Oil_Temperature = st.number_input("Lub_Oil_Temperature", min_value=1000.0, value=30000.0)
|
| 22 |
+
Coolant_Temperature = st.number_input("Coolant_Temperature", min_value=1000.0, value=30000.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# ----------------------------
|
| 25 |
# Prepare input data
|
| 26 |
# ----------------------------
|
| 27 |
input_data = pd.DataFrame([{
|
| 28 |
+
'Engine rpm': Engine_RPM,
|
| 29 |
+
'Lub oil pressure': Lub_Oil_Pressure,
|
| 30 |
+
'Fuel pressure': Fuel_Pressure,
|
| 31 |
+
'Coolant pressure': Coolant_Pressure,
|
| 32 |
+
'lub oil temp': Lub_Oil_Temperature,
|
| 33 |
+
'Coolant temp': Coolant_Temperature
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}])
|
| 35 |
|
| 36 |
# Set the classification threshold
|
|
|
|
| 40 |
if st.button("Predict"):
|
| 41 |
prob = model.predict_proba(input_data)[0,1]
|
| 42 |
pred = int(prob >= classification_threshold)
|
| 43 |
+
result = "will need the engine maintenance" if pred == 1 else "maintenance not needed"
|
| 44 |
+
st.write(f"Prediction: Engine {result}")
|