Upload folder using huggingface_hub
Browse files- Dockerfile +15 -12
- __pycache__/app.cpython-312.pyc +0 -0
- app.py +46 -0
- requirements.txt +8 -3
Dockerfile
CHANGED
|
@@ -1,20 +1,23 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
curl \
|
| 8 |
-
git \
|
| 9 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
-
|
| 11 |
-
COPY requirements.txt ./
|
| 12 |
-
COPY src/ ./src/
|
| 13 |
|
|
|
|
| 14 |
RUN pip3 install -r requirements.txt
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
# Use a minimal base image with Python 3.9 installed
|
| 2 |
+
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Set the working directory inside the container to /app
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy all files from the current directory on the host to the container's /app directory
|
| 8 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Install Python dependencies listed in requirements.txt
|
| 11 |
RUN pip3 install -r requirements.txt
|
| 12 |
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
USER user
|
| 15 |
+
ENV HOME=/home/user \
|
| 16 |
+
PATH=/home/user/.local/bin:$PATH
|
| 17 |
+
|
| 18 |
+
WORKDIR $HOME/app
|
| 19 |
|
| 20 |
+
COPY --chown=user . $HOME/app
|
| 21 |
|
| 22 |
+
# Define the command to run the Streamlit app on port "8501" and make it accessible externally
|
| 23 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|
__pycache__/app.cpython-312.pyc
ADDED
|
Binary file (2.38 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
from huggingface_hub import hf_hub_download
|
| 4 |
+
import joblib
|
| 5 |
+
|
| 6 |
+
# Download the model from the Model Hub
|
| 7 |
+
model_path = hf_hub_download(repo_id="siddhesh1981/Predictive-Maintenance-Model", filename="bagging_predict_model_v1.joblib")
|
| 8 |
+
|
| 9 |
+
# Load the model
|
| 10 |
+
model = joblib.load(model_path)
|
| 11 |
+
|
| 12 |
+
# Streamlit UI for Tourism Package Purchase Prediction
|
| 13 |
+
st.title("Predictive Maintenance Prediction App")
|
| 14 |
+
st.write("The Predictive Maintenance Prediction App is an internal tool for Fleet owners and Vehicle Manufacturers, that predicts whether a Vehicle engine is faulty and requires maintenance or not.")
|
| 15 |
+
st.write("Kindly enter the Vehicle engine sensor details to check whether the engine is faulty or not.")
|
| 16 |
+
|
| 17 |
+
# Collect user input
|
| 18 |
+
|
| 19 |
+
Engine_rpm=st.number_input('Engine rpm',min_value=60,max=2240,value=746)
|
| 20 |
+
Lub_oil_pressure= st.number_input('Lub oil pressure',min_value=0.000000,max_value=8.000000,value=3.000000)
|
| 21 |
+
Fuel_pressure= st.number_input('Fuel pressure',min_value=0.000000,max_value=22.000000,value=6.000000)
|
| 22 |
+
Coolant_pressure=st.number_input('Coolant pressure',min_value=0.000000,max_value=8.000000,value=2.000000)
|
| 23 |
+
lub_oil_temp=st.number_input('lub oil temp',min_value=70.000000,max_value=90.000000,value=76.000000)
|
| 24 |
+
Coolant_temp=st.number_input('Coolant temp',min_value=60.000000,max_value=196.000000,value=78.000000)
|
| 25 |
+
|
| 26 |
+
input_data = pd.DataFrame([{
|
| 27 |
+
'Engine_rpm': Engine_rpm,
|
| 28 |
+
'Lub_oil_pressure': Lub_oil_pressure,
|
| 29 |
+
'Fuel_pressure': Fuel_pressure,
|
| 30 |
+
'Coolant_pressure': Coolant_pressure,
|
| 31 |
+
'lub_oil_temp': lub_oil_temp,
|
| 32 |
+
'Coolant_temp': Coolant_temp
|
| 33 |
+
}])
|
| 34 |
+
|
| 35 |
+
# Predict button
|
| 36 |
+
if st.button("Predict"):
|
| 37 |
+
prediction = model.predict(input_data).astype(int)
|
| 38 |
+
result = "Faulty and requires maintenance" if prediction == 1 else "NonFaulty and does not require maintenance"
|
| 39 |
+
st.write(f"Based on the vehicle engine sensor information provided, the vehicle engine is likely to be {result}.")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
requirements.txt
CHANGED
|
@@ -1,3 +1,8 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
streamlit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==2.2.2
|
| 2 |
+
huggingface_hub==0.32.6
|
| 3 |
+
streamlit==1.43.2
|
| 4 |
+
joblib==1.5.1
|
| 5 |
+
scikit-learn==1.6.0
|
| 6 |
+
xgboost==2.1.4
|
| 7 |
+
mlflow==3.0.1
|
| 8 |
+
feature-engine==1.8.3
|