Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ scaler = load('scaler.joblib')
|
|
8 |
|
9 |
# Define numerical features for scaling
|
10 |
num_features = [
|
11 |
-
'loan_amnt', 'int_rate', 'installment', 'annual_inc', 'dti', 'revol_bal', 'revol_util', 'total_acc', 'mort_acc'
|
12 |
]
|
13 |
|
14 |
# Create the Streamlit app
|
@@ -48,13 +48,15 @@ input_data = pd.DataFrame({
|
|
48 |
'revol_bal': [revol_bal],
|
49 |
'revol_util': [revol_util],
|
50 |
'total_acc': [total_acc],
|
51 |
-
'mort_acc': [mort_acc]
|
52 |
-
'loan_amnt_by_income': [loan_amnt_by_income]
|
53 |
})
|
54 |
|
55 |
-
# Scale the
|
56 |
input_data[num_features] = scaler.transform(input_data[num_features])
|
57 |
|
|
|
|
|
|
|
58 |
# Predict using the model
|
59 |
if st.button('Predict'):
|
60 |
prediction = model.predict(input_data)
|
|
|
8 |
|
9 |
# Define numerical features for scaling
|
10 |
num_features = [
|
11 |
+
'loan_amnt', 'int_rate', 'installment', 'annual_inc', 'dti', 'revol_bal', 'revol_util', 'total_acc', 'mort_acc'
|
12 |
]
|
13 |
|
14 |
# Create the Streamlit app
|
|
|
48 |
'revol_bal': [revol_bal],
|
49 |
'revol_util': [revol_util],
|
50 |
'total_acc': [total_acc],
|
51 |
+
'mort_acc': [mort_acc]
|
|
|
52 |
})
|
53 |
|
54 |
+
# Scale the numerical features that were used to fit the scaler
|
55 |
input_data[num_features] = scaler.transform(input_data[num_features])
|
56 |
|
57 |
+
# Add the new feature
|
58 |
+
input_data['loan_amnt_by_income'] = [loan_amnt_by_income]
|
59 |
+
|
60 |
# Predict using the model
|
61 |
if st.button('Predict'):
|
62 |
prediction = model.predict(input_data)
|