prakharg24 commited on
Commit
4b89a2c
·
verified ·
1 Parent(s): 9f8f3c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -16
app.py CHANGED
@@ -135,22 +135,42 @@ with right:
135
  # Score Calculation
136
  # --------------------------------------------------
137
 
138
- cheating = 50
139
- cost = 0
140
- open_req = 0
 
141
 
142
  for action in st.session_state.owner_selected:
143
- cheating += model_owner_actions[action]["cheating"]
144
- cost += model_owner_actions[action]["cost"]
145
- open_req += model_owner_actions[action]["open"]
 
146
 
147
  for action in st.session_state.auditor_selected:
148
- cheating += auditor_actions[action]["cheating"]
149
- cost += auditor_actions[action]["cost"]
150
- open_req += auditor_actions[action]["open"]
151
 
152
- cheating = max(0, min(100, cheating))
153
- open_req = max(0, open_req)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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(3)
 
 
 
 
 
 
 
 
 
 
162
 
163
- c1.metric("Chance of Cheating", f"{cheating}%")
164
- c2.metric("Audit Cost", cost)
165
- c3.metric("Openness Required", open_req)
 
166
 
167
- st.progress(cheating / 100)
 
 
 
 
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
+ )