File size: 1,235 Bytes
f4ce365
 
 
 
 
9a5c31f
f4ce365
9a5c31f
f4ce365
 
 
 
9a5c31f
f4ce365
 
9a5c31f
f4ce365
 
 
9a5c31f
 
f4ce365
 
 
 
 
 
 
 
 
 
9a5c31f
 
 
 
f4ce365
9a5c31f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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")