Vignesh-vigu's picture
CI/CD: auto-deploy Streamlit app
9a5c31f verified
import streamlit as st
import pandas as pd
import joblib
from huggingface_hub import hf_hub_download
st.set_page_config(page_title="Engine Predictive Maintenance")
st.title("🔧 Engine Predictive Maintenance")
MODEL_REPO = "Vignesh-vigu/engine-predictive-maintenance-model"
MODEL_FILE = "xgboost_model.pkl"
model_path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE)
model = joblib.load(model_path)
engine_rpm = st.number_input("Engine RPM", 0, 3000, 1000)
lub_oil_pressure = st.number_input("Lub Oil Pressure", value=3.0)
fuel_pressure = st.number_input("Fuel Pressure", value=10.0)
coolant_pressure = st.number_input("Coolant Pressure", value=2.5)
lub_oil_temp = st.number_input("Lub Oil Temperature", value=80.0)
coolant_temp = st.number_input("Coolant Temperature", value=85.0)
input_df = pd.DataFrame([{
"engine_rpm": engine_rpm,
"lub_oil_pressure": lub_oil_pressure,
"fuel_pressure": fuel_pressure,
"coolant_pressure": coolant_pressure,
"lub_oil_temp": lub_oil_temp,
"coolant_temp": coolant_temp
}])
if st.button("Predict"):
pred = model.predict(input_df)[0]
if pred == 1:
st.error("⚠️ Engine needs maintenance")
else:
st.success("✅ Engine is healthy")