CI/CD: auto-deploy Streamlit app
Browse files- Dockerfile +0 -2
- README.md +1 -7
- app.py +11 -26
- requirements.txt +1 -0
Dockerfile
CHANGED
|
@@ -3,11 +3,9 @@ FROM python:3.10-slim
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
COPY requirements.txt .
|
| 6 |
-
|
| 7 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
|
| 9 |
COPY app.py .
|
| 10 |
|
| 11 |
EXPOSE 7860
|
| 12 |
-
|
| 13 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
COPY requirements.txt .
|
|
|
|
| 6 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
|
| 8 |
COPY app.py .
|
| 9 |
|
| 10 |
EXPOSE 7860
|
|
|
|
| 11 |
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
README.md
CHANGED
|
@@ -11,10 +11,4 @@ pinned: false
|
|
| 11 |
|
| 12 |
# Engine Predictive Maintenance App
|
| 13 |
|
| 14 |
-
|
| 15 |
-
based on real-time sensor inputs such as RPM, pressure, and temperature.
|
| 16 |
-
|
| 17 |
-
The machine learning model is trained using XGBoost and hosted on the
|
| 18 |
-
Hugging Face Model Hub. The application is deployed using Docker on
|
| 19 |
-
Hugging Face Spaces.
|
| 20 |
-
|
|
|
|
| 11 |
|
| 12 |
# Engine Predictive Maintenance App
|
| 13 |
|
| 14 |
+
Docker-based Streamlit app deployed using Hugging Face Spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -3,36 +3,22 @@ import pandas as pd
|
|
| 3 |
import joblib
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
|
| 6 |
-
st.set_page_config(
|
| 7 |
-
page_title="Engine Predictive Maintenance",
|
| 8 |
-
layout="centered"
|
| 9 |
-
)
|
| 10 |
|
| 11 |
-
st.title("🔧 Engine Predictive Maintenance
|
| 12 |
-
st.write(
|
| 13 |
-
"Predict whether an engine requires maintenance "
|
| 14 |
-
"based on sensor inputs."
|
| 15 |
-
)
|
| 16 |
|
| 17 |
-
# Load model from Hugging Face Model Hub
|
| 18 |
MODEL_REPO = "Vignesh-vigu/engine-predictive-maintenance-model"
|
| 19 |
MODEL_FILE = "xgboost_model.pkl"
|
| 20 |
|
| 21 |
-
model_path = hf_hub_download(
|
| 22 |
-
repo_id=MODEL_REPO,
|
| 23 |
-
filename=MODEL_FILE
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
model = joblib.load(model_path)
|
| 27 |
|
| 28 |
-
st.
|
| 29 |
-
|
| 30 |
-
engine_rpm = st.number_input("Engine RPM", min_value=0, max_value=3000, value=1000)
|
| 31 |
lub_oil_pressure = st.number_input("Lub Oil Pressure", value=3.0)
|
| 32 |
fuel_pressure = st.number_input("Fuel Pressure", value=10.0)
|
| 33 |
coolant_pressure = st.number_input("Coolant Pressure", value=2.5)
|
| 34 |
-
lub_oil_temp = st.number_input("Lub Oil Temperature
|
| 35 |
-
coolant_temp = st.number_input("Coolant Temperature
|
| 36 |
|
| 37 |
input_df = pd.DataFrame([{
|
| 38 |
"engine_rpm": engine_rpm,
|
|
@@ -43,10 +29,9 @@ input_df = pd.DataFrame([{
|
|
| 43 |
"coolant_temp": coolant_temp
|
| 44 |
}])
|
| 45 |
|
| 46 |
-
if st.button("Predict
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
st.error("⚠️ Engine requires maintenance!")
|
| 51 |
else:
|
| 52 |
-
st.success("✅ Engine is
|
|
|
|
| 3 |
import joblib
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
|
| 6 |
+
st.set_page_config(page_title="Engine Predictive Maintenance")
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
st.title("🔧 Engine Predictive Maintenance")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
| 10 |
MODEL_REPO = "Vignesh-vigu/engine-predictive-maintenance-model"
|
| 11 |
MODEL_FILE = "xgboost_model.pkl"
|
| 12 |
|
| 13 |
+
model_path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
model = joblib.load(model_path)
|
| 15 |
|
| 16 |
+
engine_rpm = st.number_input("Engine RPM", 0, 3000, 1000)
|
|
|
|
|
|
|
| 17 |
lub_oil_pressure = st.number_input("Lub Oil Pressure", value=3.0)
|
| 18 |
fuel_pressure = st.number_input("Fuel Pressure", value=10.0)
|
| 19 |
coolant_pressure = st.number_input("Coolant Pressure", value=2.5)
|
| 20 |
+
lub_oil_temp = st.number_input("Lub Oil Temperature", value=80.0)
|
| 21 |
+
coolant_temp = st.number_input("Coolant Temperature", value=85.0)
|
| 22 |
|
| 23 |
input_df = pd.DataFrame([{
|
| 24 |
"engine_rpm": engine_rpm,
|
|
|
|
| 29 |
"coolant_temp": coolant_temp
|
| 30 |
}])
|
| 31 |
|
| 32 |
+
if st.button("Predict"):
|
| 33 |
+
pred = model.predict(input_df)[0]
|
| 34 |
+
if pred == 1:
|
| 35 |
+
st.error("⚠️ Engine needs maintenance")
|
|
|
|
| 36 |
else:
|
| 37 |
+
st.success("✅ Engine is healthy")
|
requirements.txt
CHANGED
|
@@ -6,3 +6,4 @@ xgboost==2.1.4
|
|
| 6 |
joblib==1.4.2
|
| 7 |
dill==0.3.8
|
| 8 |
huggingface_hub>=0.34.0
|
|
|
|
|
|
| 6 |
joblib==1.4.2
|
| 7 |
dill==0.3.8
|
| 8 |
huggingface_hub>=0.34.0
|
| 9 |
+
|