Spaces:
Running
Running
Commit
·
3309e17
1
Parent(s):
50ee05f
Remove expander
Browse files
app.py
CHANGED
@@ -29,12 +29,12 @@ st.markdown(
|
|
29 |
"""
|
30 |
<style>
|
31 |
section[data-testid="stSidebar"] {
|
32 |
-
width: 300px !important;
|
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 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
column_config
|
342 |
-
"Weight"
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
column_config
|
360 |
-
"Weight"
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
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(
|