Zubair67 commited on
Commit
fceaa91
·
verified ·
1 Parent(s): 3d9cad4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import joblib
4
+
5
+ # Load model
6
+ model = joblib.load('maintenance_model.pkl')
7
+
8
+ # App UI
9
+ st.title("Smart Maintenance Planner")
10
+ st.sidebar.header("Input Parameters")
11
+
12
+ # Input form
13
+ def user_input_features():
14
+ temperature = st.sidebar.number_input("Temperature (°C)")
15
+ vibration = st.sidebar.number_input("Vibration (mm/s)")
16
+ pressure = st.sidebar.number_input("Pressure (Pa)")
17
+ return pd.DataFrame([[temperature, vibration, pressure]], columns=['temperature', 'vibration', 'pressure'])
18
+
19
+ input_df = user_input_features()
20
+
21
+ # Predictions
22
+ if st.button('Predict Maintenance Need'):
23
+ prediction = model.predict(input_df)
24
+ if prediction[0] == 1:
25
+ st.error("Maintenance Required!")
26
+ else:
27
+ st.success("Unit is functioning normally.")
28
+
29
+ # Dashboard
30
+ st.subheader("Operational Data Overview")
31
+ # Replace with your data source
32
+ st.dataframe(input_df)