Spaces:
Running
Running
Commit
·
50ee05f
1
Parent(s):
9cb79eb
Add error handling for react exception
Browse files
app.py
CHANGED
@@ -326,45 +326,53 @@ elif st.session_state.predict_button_clicked and st.session_state.exp is not Non
|
|
326 |
# + " \n For more details, see full explanation of the credit assessment below.",
|
327 |
)
|
328 |
explanation_expander = st.expander("Show explanation")
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
"Weight"
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
"Weight"
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
st.divider()
|
370 |
|
|
|
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(
|
372 |
+
"Failed to show the explanation."
|
373 |
+
+ "Refresh the page to reset the application."
|
374 |
+
+ "Contact Deeploy if the problem persists."
|
375 |
+
)
|
376 |
|
377 |
st.divider()
|
378 |
|