rashid01 commited on
Commit
0fd6f85
·
verified ·
1 Parent(s): 9761264

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -6,10 +6,10 @@ from joblib import load
6
  model = load('loandefaulter.joblib')
7
  scaler = load('scaler.joblib')
8
 
9
- # Define numerical features for scaling
10
  num_features = [
11
  'loan_amnt', 'int_rate', 'installment', 'annual_inc', 'dti',
12
- 'revol_bal', 'revol_util', 'total_acc', 'mort_acc', 'cibil_score'
13
  ]
14
 
15
  # Create the Streamlit app
@@ -53,15 +53,15 @@ input_data = pd.DataFrame({
53
  'revol_bal': [revol_bal],
54
  'revol_util': [revol_util],
55
  'total_acc': [total_acc],
56
- 'mort_acc': [mort_acc],
57
- 'cibil_score': [cibil_score]
58
  })
59
 
60
  # Scale the numerical features that were used to fit the scaler
61
  input_data[num_features] = scaler.transform(input_data[num_features])
62
 
63
- # Add the new feature
64
  input_data['loan_amnt_by_income'] = [loan_amnt_by_income]
 
65
 
66
  # Predict using the model
67
  if st.button('Predict'):
@@ -71,5 +71,3 @@ if st.button('Predict'):
71
  st.markdown(f"""
72
  <div style="font-size: 24px; color: {color}; font-weight: bold;">Prediction: {result}</div>
73
  """, unsafe_allow_html=True)
74
-
75
-
 
6
  model = load('loandefaulter.joblib')
7
  scaler = load('scaler.joblib')
8
 
9
+ # Define numerical features for scaling (only those that were used during training)
10
  num_features = [
11
  'loan_amnt', 'int_rate', 'installment', 'annual_inc', 'dti',
12
+ 'revol_bal', 'revol_util', 'total_acc', 'mort_acc'
13
  ]
14
 
15
  # Create the Streamlit app
 
53
  'revol_bal': [revol_bal],
54
  'revol_util': [revol_util],
55
  'total_acc': [total_acc],
56
+ 'mort_acc': [mort_acc]
 
57
  })
58
 
59
  # Scale the numerical features that were used to fit the scaler
60
  input_data[num_features] = scaler.transform(input_data[num_features])
61
 
62
+ # Add the additional feature (not part of scaling)
63
  input_data['loan_amnt_by_income'] = [loan_amnt_by_income]
64
+ input_data['cibil_score'] = cibil_score # Add cibil_score directly without scaling
65
 
66
  # Predict using the model
67
  if st.button('Predict'):
 
71
  st.markdown(f"""
72
  <div style="font-size: 24px; color: {color}; font-weight: bold;">Prediction: {result}</div>
73
  """, unsafe_allow_html=True)