vihu21 commited on
Commit
61fa386
·
verified ·
1 Parent(s): 9484c1d

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from huggingface_hub import hf_hub_download
4
+ import joblib
5
+
6
+ # Download and load the trained model
7
+ model_path = hf_hub_download(repo_id="vihu21/predictive_maintenance", filename="best_ada_model.joblib")
8
+ model = joblib.load(model_path)
9
+
10
+ # Streamlit UI
11
+ st.title("Engine Condition Prediction")
12
+ st.write("""
13
+ Fill the engine details below to predict if engine condition good or bad
14
+ """)
15
+
16
+
17
+
18
+ # User input
19
+ Engine_Details = st.number_input("Engine_Details Size (MB)", min_value=1.0, max_value=4000.0, value=50.0, step=0.1)
20
+ EngineRpm = st.number_input("Engine rpm", min_value=50, value=3000.0)
21
+ LubOilPressure = st.number_input("Lub oil pressure", min_value=0, value=7.25)
22
+ FuelPressure = st.number_input("Fuel pressure", min_value=0, value=21.4)
23
+ CoolantPressure = st.number_input("Coolant pressure", min_value=0, value=7.5)
24
+ lubOilTemp = st.number_input("lub oil temp", min_value=70, value=90.0)
25
+ CoolantTemp = st.number_input("Coolant temp", min_value=60, value=195.0)
26
+
27
+ # ----------------------------
28
+ # Prepare input data
29
+ # ----------------------------
30
+ input_data = pd.DataFrame([{
31
+ 'Engine rpm': EngineRpm,
32
+ 'Lub oil pressure': LubOilPressure,
33
+ 'Fuel pressure': FuelPressure,
34
+ 'Coolant pressure': CoolantPressure,
35
+ 'lub oil temp': lubOilTemp,
36
+ 'Coolant temp': CoolantTemp
37
+ }])
38
+
39
+
40
+
41
+ # Predict button
42
+ if st.button("Predict Engine"):
43
+ prediction = model.predict(input_data)[0]
44
+ st.subheader("Prediction Result:")
45
+ st.success(f"Estimated EngineCondition: **${prediction:,.2f} ")