deeploy-adubowski commited on
Commit
3309e17
·
1 Parent(s): 50ee05f

Remove expander

Browse files
Files changed (1) hide show
  1. app.py +40 -44
app.py CHANGED
@@ -29,12 +29,12 @@ st.markdown(
29
  """
30
  <style>
31
  section[data-testid="stSidebar"] {
32
- width: 300px !important; # Set the width to your desired value
33
  }
34
  </style>
35
  """,
36
  unsafe_allow_html=True,
37
- )
38
 
39
 
40
  def get_model_url():
@@ -123,7 +123,6 @@ def submit_and_clear(evaluation: str):
123
  st.session_state.evaluation_input["result"] = 1
124
  st.session_state.evaluation_input["value"] = {"predictions": [desired_output]}
125
  try:
126
- # Call the explain endpoint as it also includes the prediction
127
  client.evaluate(
128
  deployment_id, request_log_id, prediction_log_id, st.session_state.evaluation_input
129
  )
@@ -323,49 +322,46 @@ elif st.session_state.predict_button_clicked and st.session_state.exp is not Non
323
  st.warning(
324
  "However, the following factors weigh in favor of the loan applicant: \n - "
325
  + " \n - ".join(pos_feats)
326
- # + " \n For more details, see full explanation of the credit assessment below.",
327
  )
328
- explanation_expander = st.expander("Show explanation")
329
  try:
330
- with explanation_expander:
331
- # Show explanation
332
- col_pos, col_neg = st.columns(2)
333
-
334
- with col_pos:
335
- st.subheader("Factors :green[in favor] of loan approval")
336
- # st.success("**Factors in favor of loan approval**")
337
- st.dataframe(
338
- pos_exp_df_t,
339
- hide_index=True,
340
- width=600,
341
- column_config={
342
- "Weight": st.column_config.ProgressColumn(
343
- "Weight",
344
- width="small",
345
- format=" ",
346
- min_value=0,
347
- max_value=1,
348
- )
349
- },
350
- )
351
-
352
- with col_neg:
353
- st.subheader("Factors :red[against] loan approval")
354
- # st.error("**Factors against loan approval**")
355
- st.dataframe(
356
- neg_exp_df_t,
357
- hide_index=True,
358
- width=600,
359
- column_config={
360
- "Weight": st.column_config.ProgressColumn(
361
- "Weight",
362
- width="small",
363
- format=" ",
364
- min_value=0,
365
- max_value=1,
366
- )
367
- },
368
- )
369
  except Exception as e:
370
  logging.error(e)
371
  st.error(
 
29
  """
30
  <style>
31
  section[data-testid="stSidebar"] {
32
+ width: 300px !important;
33
  }
34
  </style>
35
  """,
36
  unsafe_allow_html=True,
37
+ ) # Set the side bar width to fit the Deeploy logo
38
 
39
 
40
  def get_model_url():
 
123
  st.session_state.evaluation_input["result"] = 1
124
  st.session_state.evaluation_input["value"] = {"predictions": [desired_output]}
125
  try:
 
126
  client.evaluate(
127
  deployment_id, request_log_id, prediction_log_id, st.session_state.evaluation_input
128
  )
 
322
  st.warning(
323
  "However, the following factors weigh in favor of the loan applicant: \n - "
324
  + " \n - ".join(pos_feats)
 
325
  )
 
326
  try:
327
+ # Show explanation
328
+ col_pos, col_neg = st.columns(2)
329
+
330
+ with col_pos:
331
+ st.subheader("Factors :green[in favor] of loan approval")
332
+ # st.success("**Factors in favor of loan approval**")
333
+ st.dataframe(
334
+ pos_exp_df_t,
335
+ hide_index=True,
336
+ width=600,
337
+ column_config={
338
+ "Weight": st.column_config.ProgressColumn(
339
+ "Weight",
340
+ width="small",
341
+ format=" ",
342
+ min_value=0,
343
+ max_value=1,
344
+ )
345
+ },
346
+ )
347
+
348
+ with col_neg:
349
+ st.subheader("Factors :red[against] loan approval")
350
+ # st.error("**Factors against loan approval**")
351
+ st.dataframe(
352
+ neg_exp_df_t,
353
+ hide_index=True,
354
+ width=600,
355
+ column_config={
356
+ "Weight": st.column_config.ProgressColumn(
357
+ "Weight",
358
+ width="small",
359
+ format=" ",
360
+ min_value=0,
361
+ max_value=1,
362
+ )
363
+ },
364
+ )
 
365
  except Exception as e:
366
  logging.error(e)
367
  st.error(