SunnyShaurya commited on
Commit
d0e7dcc
·
verified ·
1 Parent(s): 21fa103

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +10 -0
  2. app.py +40 -0
  3. requirements.txt +5 -0
Dockerfile ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import joblib
4
+ from huggingface_hub import hf_hub_download
5
+
6
+ st.title("Engine Fault Prediction")
7
+
8
+ # download model
9
+ model_path = hf_hub_download(
10
+ repo_id="SunnyShaurya/engine-fault-model",
11
+ filename="best_model.pkl"
12
+ )
13
+
14
+ model = joblib.load(model_path)
15
+
16
+ st.header("Enter Engine Sensor Values")
17
+
18
+ rpm = st.number_input("Engine RPM")
19
+ oil_p = st.number_input("Lub Oil Pressure")
20
+ fuel_p = st.number_input("Fuel Pressure")
21
+ cool_p = st.number_input("Coolant Pressure")
22
+ oil_t = st.number_input("Lub Oil Temperature")
23
+ cool_t = st.number_input("Coolant Temperature")
24
+
25
+ if st.button("Predict"):
26
+ data = pd.DataFrame([{
27
+ "Engine_RPM": rpm,
28
+ "Lub_Oil_Pressure": oil_p,
29
+ "Fuel_Pressure": fuel_p,
30
+ "Coolant_Pressure": cool_p,
31
+ "Lub_Oil_Temperature": oil_t,
32
+ "Coolant_Temperature": cool_t
33
+ }])
34
+
35
+ result = model.predict(data)[0]
36
+
37
+ if result == 1:
38
+ st.error("⚠ Engine Fault Detected")
39
+ else:
40
+ st.success("✅ Engine Normal")
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ streamlit
2
+ pandas
3
+ scikit-learn
4
+ joblib
5
+ huggingface_hub