WSYAM806 commited on
Commit
8299cbb
·
1 Parent(s): b5f9ab6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -104,20 +104,20 @@ with App:
104
  input = pd.DataFrame(data, index=[0])
105
  st.subheader('User Input')
106
  st.write(input)
107
-
108
  if st.button('Cluster'):
109
  num_col = [' income_annum', ' loan_amount', ' loan_term', ' cibil_score', ' residential_assets_value', ' commercial_assets_value', ' luxury_assets_value', ' bank_asset_value']
110
  def_cluster = input.drop(columns=[col for col in input.columns if col not in num_col])
111
  def_pca = cluster.transform(def_cluster)
112
  labelz = k_3.predict(def_pca)
113
-
114
  if np.all(labelz == 0):
115
  st.write('Based on user input, the placement cluster: Moderate-Risk Customers')
116
  elif np.all(labelz == 1):
117
  st.write('Based on user input, the placement cluster: Low-Risk Customers')
118
  elif np.all(labelz == 2):
119
  st.write('Based on user input, the placement cluster: High-Risk Customers')
120
- input['cluster'] = labelz
121
 
122
  if st.button('predict'):
123
  prediction = model.predict(input)
 
104
  input = pd.DataFrame(data, index=[0])
105
  st.subheader('User Input')
106
  st.write(input)
107
+ label3 = []
108
  if st.button('Cluster'):
109
  num_col = [' income_annum', ' loan_amount', ' loan_term', ' cibil_score', ' residential_assets_value', ' commercial_assets_value', ' luxury_assets_value', ' bank_asset_value']
110
  def_cluster = input.drop(columns=[col for col in input.columns if col not in num_col])
111
  def_pca = cluster.transform(def_cluster)
112
  labelz = k_3.predict(def_pca)
113
+ label3.append(labelz)
114
  if np.all(labelz == 0):
115
  st.write('Based on user input, the placement cluster: Moderate-Risk Customers')
116
  elif np.all(labelz == 1):
117
  st.write('Based on user input, the placement cluster: Low-Risk Customers')
118
  elif np.all(labelz == 2):
119
  st.write('Based on user input, the placement cluster: High-Risk Customers')
120
+ input['cluster'] = label3
121
 
122
  if st.button('predict'):
123
  prediction = model.predict(input)