deepacsr commited on
Commit
b81be7b
·
verified ·
1 Parent(s): cee7108

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +43 -0
  2. version.txt +1 -1
app.py CHANGED
@@ -8,3 +8,46 @@ import streamlit as st
8
  # Below commented code created for debugging
9
  st.title("Test App Running")
10
  st.write("If you see this, Docker is fine.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # Below commented code created for debugging
9
  st.title("Test App Running")
10
  st.write("If you see this, Docker is fine.")
11
+
12
+ # Download and load the trained model that was aved
13
+ model_path = hf_hub_download(repo_id="deepacsr/predictive-maintenance", filename="best_package_prediction_model_v1.joblib")
14
+ model = joblib.load(model_path)
15
+
16
+ # Streamlit UI
17
+ st.title("Predictive Maintenance")
18
+ st.write("""
19
+ This application predicts if Engine is likely to go Faulty or working in Nornaml condition.
20
+ """)
21
+
22
+ # For numerical variables, Min and Max value taken based on the current data available.
23
+ # Default value set at mean value
24
+ EngineRPM = st.number_input("Engine RPM", min_value=60, max_value=2240, value=791, step =50)
25
+ LubricanOilPressure = st.number_input("Lubricant oil pressure", min_value=0.003, max_value=7.2, value=3.3, step =0.1)
26
+ FuelPressure = st.number_input("Fuel Pressure", min_value=0.003, max_value=21.1, value=6.6, step =0.1)
27
+ CoolantPressure = st.number_input("Coolant Pressure", min_value=0.0024, max_value=7472, value=2.33, step =0.1)
28
+ LubricantOilTemp = st.number_input("Lubricant Oil Temp", min_value=71.3, max_value=89.58, value=77.64, step =1)
29
+ CoolantTemp = st.number_input("Coolant Temp", min_value=61.67, max_value=195.52, value=78.42, step =1)
30
+
31
+ # Assemble input into DataFrame
32
+ input_data = pd.DataFrame([{
33
+ "Engine rpm": EngineRPM,
34
+ "Lub oil pressure": LubricanOilPressure,
35
+ "Fuel pressure": FuelPressure,
36
+ "Coolant pressure": CoolantPressure,
37
+ "lub oil temp": LubricantOilTemp,
38
+ "Coolant temp": CoolantTemp
39
+ }])
40
+
41
+
42
+ # Predict button
43
+
44
+ if st.button("Predict Maintenance"):
45
+ prediction = model.predict(input_data)[0]
46
+ # Model predicts based on the input value
47
+
48
+ st.subheader("Prediction Result:")
49
+
50
+ if prediction == 0:
51
+ st.success("Engine is in normal conmdition")
52
+ else:
53
+ st.warning("Engine Likely to Fail")
version.txt CHANGED
@@ -1 +1 @@
1
- 2026-05-25 14:41:55.350511
 
1
+ 2026-05-25 15:57:11.295022