Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,56 @@ st.sidebar.header('Enter the Components Details here')
|
|
| 17 |
# Dropping the SRU serial number
|
| 18 |
df.drop(['SRU serial number','Date of Manufacture','Last Maintenance Date','date of last failure'], axis = 1, inplace=True)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
def label_encoder(df):
|
| 21 |
le = LabelEncoder()
|
| 22 |
cat = df.select_dtypes(include='O').keys()
|
|
|
|
| 17 |
# Dropping the SRU serial number
|
| 18 |
df.drop(['SRU serial number','Date of Manufacture','Last Maintenance Date','date of last failure'], axis = 1, inplace=True)
|
| 19 |
|
| 20 |
+
# DATA from user
|
| 21 |
+
def user_report():
|
| 22 |
+
manufacturer = st.sidebar.selectbox("Manufacturer",
|
| 23 |
+
("JKL Company", "GHI Company","AGS Company","ABC Company","ABC Company","XYZ Company" ))
|
| 24 |
+
if manufacturer=='JKL Company':
|
| 25 |
+
manufacturer=3
|
| 26 |
+
elif manufacturer=="GHI Company":
|
| 27 |
+
manufacturer=2
|
| 28 |
+
elif manufacturer=="AGS Company":
|
| 29 |
+
manufacturer=1
|
| 30 |
+
elif manufacturer=="ABC Company":
|
| 31 |
+
manufacturer =0
|
| 32 |
+
else:
|
| 33 |
+
manufacturer=4
|
| 34 |
+
component_age = st.sidebar.slider('Component Age (in hours)', 500,2000, 600 )
|
| 35 |
+
total_operating_hours = st.sidebar.slider('Total Operating Hours)', 50,2000, 500 )
|
| 36 |
+
usage_intensity = st.sidebar.slider('Usage Intensity hours/day', 0,9, 5 )
|
| 37 |
+
last_maintance_type = st.sidebar.selectbox('Last Mantainence Type', ("Preventive","Corrective") )
|
| 38 |
+
if last_maintance_type=="Preventive":
|
| 39 |
+
last_maintance_type=1
|
| 40 |
+
else:
|
| 41 |
+
last_maintance_type=0
|
| 42 |
+
previous_number_of_repairs = st.sidebar.number_input('Enter the Previous Number of Repairs Undergone 0 to 5 )',min_value=0,max_value=5,step=1)
|
| 43 |
+
operating_temperature = st.sidebar.slider('Operating Temperature', 10,25, 15 )
|
| 44 |
+
humidity = st.sidebar.slider('Humidity', 20,105, 25 )
|
| 45 |
+
Vibration Level = st.sidebar.slider('Vibration Level', 2,7, 2.5 )
|
| 46 |
+
Pressure = st.sidebar.slider('Pressure', 200,550, 250 )
|
| 47 |
+
Power_Input_Voltage= st.slider('Power Input Voltage (V)',100,133,115)
|
| 48 |
+
repair_type = st.sidebar.selectbox('Repair Type', ("Hardware","Software") )
|
| 49 |
+
if repair_type=='Hardware':
|
| 50 |
+
repair_type=0
|
| 51 |
+
else:
|
| 52 |
+
repair_type=1
|
| 53 |
+
number_of_inspection = st.sidebar.selectbox('Number of Inspections',('1','2'))
|
| 54 |
+
if number_of_inspection=='1':
|
| 55 |
+
number_of_inspection=1
|
| 56 |
+
else:
|
| 57 |
+
number_of_inspection=2
|
| 58 |
+
number_of_inspection_6months = st.sidebar.selectbox('Number of Inspections in last 6 Months',('0','1'))
|
| 59 |
+
if number_of_inspection_6months=='0':
|
| 60 |
+
number_of_inspection_6months=0
|
| 61 |
+
else:
|
| 62 |
+
number_of_inspection_6months=1
|
| 63 |
+
prior_maintainence = st.sidebar.selectbox('Prior Maintainence',("Regular","Irregular"))
|
| 64 |
+
if prior_maintainence =='Regular':
|
| 65 |
+
prior_maintainence=1
|
| 66 |
+
else:
|
| 67 |
+
prior_maintainence=0
|
| 68 |
+
|
| 69 |
+
|
| 70 |
def label_encoder(df):
|
| 71 |
le = LabelEncoder()
|
| 72 |
cat = df.select_dtypes(include='O').keys()
|