import streamlit as st import pandas as pd import joblib from huggingface_hub import hf_hub_download st.title("Predictive Maintenance - Engine Condition Classifier") # Load model from Hugging Face MODEL_REPO = "MohammedSohail/engine_maintenance_model" model_path = hf_hub_download( repo_id=MODEL_REPO, filename="model/best_model.pkl" ) model = joblib.load(model_path) st.subheader("Enter Engine Sensor Values") # UI Inputs (same features used during training) features = { "Coolant_Temperature": st.number_input("Coolant Temperature", value=75.0), "Lub_Oil_Pressure": st.number_input("Lubricant Oil Pressure", value=3.5), "Fuel_Pressure": st.number_input("Fuel Pressure", value=1.2), "Engine_RPM": st.number_input("Engine RPM", value=1500), "Turbocharger_Speed": st.number_input("Turbocharger Speed", value=9000), "Cylinder_Head_Temperature": st.number_input("Cylinder Head Temperature", value=120) } if st.button("Predict Engine Condition"): input_df = pd.DataFrame([features]) prediction = model.predict(input_df)[0] st.success(f"Predicted Engine Condition: 🚦 {prediction}")