Spaces:
Sleeping
Sleeping
Commit
·
6d925bd
1
Parent(s):
885d18e
Update evaluation call
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import streamlit.components.v1 as components
|
|
| 3 |
import streamlit as st
|
| 4 |
import pandas as pd
|
| 5 |
import logging
|
| 6 |
-
from deeploy import Client
|
| 7 |
from constants import (
|
| 8 |
relationship_dict,
|
| 9 |
occupation_dict,
|
|
@@ -146,17 +146,22 @@ def hide_expander():
|
|
| 146 |
def show_expander():
|
| 147 |
st.session_state.expander_toggle = True
|
| 148 |
|
| 149 |
-
def submit_and_clear(
|
| 150 |
-
if
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
| 152 |
else:
|
| 153 |
desired_output = not predictions[0]
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
try:
|
| 157 |
-
client.evaluate(
|
| 158 |
-
deployment_id, request_log_id, prediction_log_id, st.session_state.evaluation_input
|
| 159 |
-
)
|
| 160 |
st.session_state.evaluation_submitted = True
|
| 161 |
st.session_state.predict_button_clicked = False
|
| 162 |
st.session_state.exp = None
|
|
@@ -384,8 +389,6 @@ elif st.session_state.predict_button_clicked and st.session_state.exp is not Non
|
|
| 384 |
)
|
| 385 |
st.session_state.evaluation_input = {}
|
| 386 |
comment = st.text_input("Your assessment:", placeholder="For example: 'Income is too low, given applicant's background'")
|
| 387 |
-
if comment:
|
| 388 |
-
st.session_state.evaluation_input["explanation"] = comment
|
| 389 |
|
| 390 |
cols = st.columns(4)
|
| 391 |
col_yes, col_no = cols[:2]
|
|
@@ -396,7 +399,7 @@ elif st.session_state.predict_button_clicked and st.session_state.exp is not Non
|
|
| 396 |
use_container_width=True,
|
| 397 |
help="Click if you agree with the prediction",
|
| 398 |
on_click=submit_and_clear,
|
| 399 |
-
args=["yes"]
|
| 400 |
)
|
| 401 |
ChangeButtonColour("Yes, I agree", "white", "green")
|
| 402 |
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
import pandas as pd
|
| 5 |
import logging
|
| 6 |
+
from deeploy import Client, CreateEvaluation
|
| 7 |
from constants import (
|
| 8 |
relationship_dict,
|
| 9 |
occupation_dict,
|
|
|
|
| 146 |
def show_expander():
|
| 147 |
st.session_state.expander_toggle = True
|
| 148 |
|
| 149 |
+
def submit_and_clear(agree: str, comment: str = None):
|
| 150 |
+
if agree == "yes":
|
| 151 |
+
evaluation_input: CreateEvaluation = {
|
| 152 |
+
"agree": True,
|
| 153 |
+
"comment": comment,
|
| 154 |
+
}
|
| 155 |
else:
|
| 156 |
desired_output = not predictions[0]
|
| 157 |
+
evaluation_input: CreateEvaluation = {
|
| 158 |
+
"agree": False,
|
| 159 |
+
"desired_output": { "predictions": [desired_output] },
|
| 160 |
+
"comment": comment,
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
try:
|
| 164 |
+
client.evaluate(st.session_state.deployment_id, prediction_log_id, evaluation_input)
|
|
|
|
|
|
|
| 165 |
st.session_state.evaluation_submitted = True
|
| 166 |
st.session_state.predict_button_clicked = False
|
| 167 |
st.session_state.exp = None
|
|
|
|
| 389 |
)
|
| 390 |
st.session_state.evaluation_input = {}
|
| 391 |
comment = st.text_input("Your assessment:", placeholder="For example: 'Income is too low, given applicant's background'")
|
|
|
|
|
|
|
| 392 |
|
| 393 |
cols = st.columns(4)
|
| 394 |
col_yes, col_no = cols[:2]
|
|
|
|
| 399 |
use_container_width=True,
|
| 400 |
help="Click if you agree with the prediction",
|
| 401 |
on_click=submit_and_clear,
|
| 402 |
+
args=["yes", comment]
|
| 403 |
)
|
| 404 |
ChangeButtonColour("Yes, I agree", "white", "green")
|
| 405 |
|