Update app.py
Browse files
app.py
CHANGED
|
@@ -135,22 +135,42 @@ with right:
|
|
| 135 |
# Score Calculation
|
| 136 |
# --------------------------------------------------
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
| 141 |
|
| 142 |
for action in st.session_state.owner_selected:
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
|
|
|
| 146 |
|
| 147 |
for action in st.session_state.auditor_selected:
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
# --------------------------------------------------
|
| 156 |
# Dashboard
|
|
@@ -158,10 +178,24 @@ open_req = max(0, open_req)
|
|
| 158 |
|
| 159 |
st.divider()
|
| 160 |
|
| 161 |
-
c1, c2, c3 = st.columns(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
| 166 |
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
# Score Calculation
|
| 136 |
# --------------------------------------------------
|
| 137 |
|
| 138 |
+
auditor_cost = 0
|
| 139 |
+
owner_cost = 0
|
| 140 |
+
reliability = 50
|
| 141 |
+
openness = 0
|
| 142 |
|
| 143 |
for action in st.session_state.owner_selected:
|
| 144 |
+
auditor_cost += model_owner_actions[action]["cost"]
|
| 145 |
+
owner_cost += 10 # simple baseline cost for owner strategies
|
| 146 |
+
reliability -= model_owner_actions[action]["cheating"]
|
| 147 |
+
openness += model_owner_actions[action]["open"]
|
| 148 |
|
| 149 |
for action in st.session_state.auditor_selected:
|
| 150 |
+
auditor_cost += auditor_actions[action]["cost"]
|
| 151 |
+
reliability -= auditor_actions[action]["cheating"]
|
| 152 |
+
openness += auditor_actions[action]["open"]
|
| 153 |
|
| 154 |
+
reliability = max(0, min(100, reliability))
|
| 155 |
+
openness = max(0, openness)
|
| 156 |
+
|
| 157 |
+
# --------------------------------------------------
|
| 158 |
+
# Convert to Levels
|
| 159 |
+
# --------------------------------------------------
|
| 160 |
+
|
| 161 |
+
def level(score):
|
| 162 |
+
if score < 30:
|
| 163 |
+
return "Low"
|
| 164 |
+
elif score < 60:
|
| 165 |
+
return "Medium"
|
| 166 |
+
else:
|
| 167 |
+
return "High"
|
| 168 |
+
|
| 169 |
+
indicator_map = {
|
| 170 |
+
"Low": "🟢 Low",
|
| 171 |
+
"Medium": "🟡 Medium",
|
| 172 |
+
"High": "🔴 High"
|
| 173 |
+
}
|
| 174 |
|
| 175 |
# --------------------------------------------------
|
| 176 |
# Dashboard
|
|
|
|
| 178 |
|
| 179 |
st.divider()
|
| 180 |
|
| 181 |
+
c1, c2, c3, c4 = st.columns(4)
|
| 182 |
+
|
| 183 |
+
c1.metric(
|
| 184 |
+
"Cost for Auditor",
|
| 185 |
+
indicator_map[level(auditor_cost)]
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
c2.metric(
|
| 189 |
+
"Cost for Model Owner",
|
| 190 |
+
indicator_map[level(owner_cost)]
|
| 191 |
+
)
|
| 192 |
|
| 193 |
+
c3.metric(
|
| 194 |
+
"Audit Reliability",
|
| 195 |
+
indicator_map[level(reliability)]
|
| 196 |
+
)
|
| 197 |
|
| 198 |
+
c4.metric(
|
| 199 |
+
"Openness Requirements",
|
| 200 |
+
indicator_map[level(openness)]
|
| 201 |
+
)
|