deeploy-adubowski commited on
Commit
e967b25
·
1 Parent(s): 7995f88

Design updates

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -23,7 +23,7 @@ logging.basicConfig(level=logging.INFO)
23
 
24
  st.set_page_config(layout="wide")
25
 
26
- st.title("Credit-Scoring Model Explainability")
27
 
28
  st.markdown(
29
  """
@@ -104,7 +104,7 @@ def submit_and_clear():
104
  client.evaluate(
105
  deployment_id, request_log_id, prediction_log_id, st.session_state.evaluation_input
106
  )
107
- st.toast(":green[Feedback submitted successfully.]", icon="✅")
108
  st.session_state.eval_selected = False
109
  st.session_state.evaluation_submitted = True
110
  st.session_state.eval_selected = False
@@ -115,7 +115,7 @@ def submit_and_clear():
115
  + "Check whether you are using the right model URL and token for evaluations. "
116
  + "Contact Deeploy if the problem persists."
117
  )
118
- st.toast(f"Failed to submit feedback: {e}")
119
 
120
 
121
  def hide_expander():
@@ -275,7 +275,7 @@ if st.session_state.predict_button_clicked:
275
 
276
  if predictions[0]:
277
  # Show prediction
278
- st.subheader("Loan Decision: :green[POSITIVE]", divider="green")
279
  # Format subheader to green
280
  st.markdown(
281
  "<style>.css-1v3fvcr{color: green;}</style>", unsafe_allow_html=True
@@ -283,23 +283,23 @@ if st.session_state.predict_button_clicked:
283
 
284
  # If prediction is positive, first show positive features, then negative features
285
  st.success(
286
- "**Positive creditworthiness**. This is primarily attributed to: \n - "
287
  + " \n- ".join(pos_feats)
288
  )
289
  st.warning(
290
- "However, the following features weight ***against*** the loan application: \n - "
291
  + " \n- ".join(neg_feats)
292
  + " \n For more details, see full explanation of the credit assessment below.",
293
  )
294
  else:
295
- st.subheader("Loan Decision: :red[NEGATIVE]", divider="red")
296
  # If prediction is negative, first show negative features, then positive features
297
  st.error(
298
- "**Negative creditworthiness**. This is primarily attributed to: \n - "
299
  + " \n - ".join(neg_feats)
300
  )
301
  st.warning(
302
- "However, the following factors weigh ***in favor*** of the loan applicant: \n - "
303
  + " \n - ".join(pos_feats)
304
  + " \n For more details, see full explanation of the credit assessment below.",
305
  )
@@ -348,7 +348,7 @@ if st.session_state.predict_button_clicked:
348
 
349
  if not st.session_state.evaluation_submitted:
350
  # Add prediction evaluation
351
- st.subheader("Evaluation: Do you agree with the predicted creditworthiness?")
352
  st.info(
353
  "AI model predictions always come with a certain level of uncertainty. \nEvaluate the correctness of the prediction based on your expertise and experience."
354
  )
@@ -390,13 +390,13 @@ if st.session_state.predict_button_clicked:
390
  st.session_state.placeholder = "Income is too low, given applicant's background"
391
 
392
  if st.session_state.eval_selected:
393
- comment = st.text_input("Would you like to add a comment?", placeholder=st.session_state.placeholder)
394
  if comment:
395
  st.session_state.evaluation_input["explanation"] = comment
396
 
397
  st.button("Submit", key="submit_button", on_click=submit_and_clear)
398
  else:
399
- st.write("Loan application already evaluated - send another loan application to evaluate again.")
400
 
401
  except Exception as e:
402
  logging.error(e)
 
23
 
24
  st.set_page_config(layout="wide")
25
 
26
+ st.title("Loan application model example")
27
 
28
  st.markdown(
29
  """
 
104
  client.evaluate(
105
  deployment_id, request_log_id, prediction_log_id, st.session_state.evaluation_input
106
  )
107
+ # st.toast(":green-background[Feedback submitted successfully.]", icon="✅")
108
  st.session_state.eval_selected = False
109
  st.session_state.evaluation_submitted = True
110
  st.session_state.eval_selected = False
 
115
  + "Check whether you are using the right model URL and token for evaluations. "
116
  + "Contact Deeploy if the problem persists."
117
  )
118
+ # st.toast(f"Failed to submit feedback: {e}")
119
 
120
 
121
  def hide_expander():
 
275
 
276
  if predictions[0]:
277
  # Show prediction
278
+ st.subheader("Loan Decision: :green[Approve]", divider="green")
279
  # Format subheader to green
280
  st.markdown(
281
  "<style>.css-1v3fvcr{color: green;}</style>", unsafe_allow_html=True
 
283
 
284
  # If prediction is positive, first show positive features, then negative features
285
  st.success(
286
+ "**Positive creditworthiness**. The most important characteristics in favor of loan approval are: \n - "
287
  + " \n- ".join(pos_feats)
288
  )
289
  st.warning(
290
+ "However, the following features weight against the loan applicant: \n - "
291
  + " \n- ".join(neg_feats)
292
  + " \n For more details, see full explanation of the credit assessment below.",
293
  )
294
  else:
295
+ st.subheader("Loan Decision: :red[Reject]", divider="red")
296
  # If prediction is negative, first show negative features, then positive features
297
  st.error(
298
+ "**Negative creditworthiness**. The most important characteristics in favor of loan rejection are: \n - "
299
  + " \n - ".join(neg_feats)
300
  )
301
  st.warning(
302
+ "However, the following factors weigh in favor of the loan applicant: \n - "
303
  + " \n - ".join(pos_feats)
304
  + " \n For more details, see full explanation of the credit assessment below.",
305
  )
 
348
 
349
  if not st.session_state.evaluation_submitted:
350
  # Add prediction evaluation
351
+ st.subheader("Evaluation: Do you agree with the loan assessment?")
352
  st.info(
353
  "AI model predictions always come with a certain level of uncertainty. \nEvaluate the correctness of the prediction based on your expertise and experience."
354
  )
 
390
  st.session_state.placeholder = "Income is too low, given applicant's background"
391
 
392
  if st.session_state.eval_selected:
393
+ comment = st.text_input("Would you like to add a comment?", placeholder="For example: '" + st.session_state.placeholder + "'")
394
  if comment:
395
  st.session_state.evaluation_input["explanation"] = comment
396
 
397
  st.button("Submit", key="submit_button", on_click=submit_and_clear)
398
  else:
399
+ st.success("Evaluation submitted successfully!")
400
 
401
  except Exception as e:
402
  logging.error(e)