Update app.py
Browse files
app.py
CHANGED
|
@@ -2,24 +2,26 @@ import streamlit as st
|
|
| 2 |
|
| 3 |
st.set_page_config(layout="wide")
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# --------------------------------------------------
|
| 8 |
# Strategy Definitions
|
| 9 |
# --------------------------------------------------
|
| 10 |
|
| 11 |
model_owner_actions = {
|
| 12 |
-
"
|
| 13 |
-
"
|
| 14 |
-
"Training special audit behaviour": {"cheating": 30, "cost": 5, "open": -10},
|
| 15 |
-
"Withholding training details": {"cheating": 15, "cost": 0, "open": -15},
|
| 16 |
}
|
| 17 |
|
| 18 |
auditor_actions = {
|
| 19 |
-
"Audit
|
| 20 |
-
"Audit
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
}
|
| 24 |
|
| 25 |
# --------------------------------------------------
|
|
@@ -135,12 +137,38 @@ with right:
|
|
| 135 |
# Score Calculation
|
| 136 |
# --------------------------------------------------
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|
|
|
|
| 2 |
|
| 3 |
st.set_page_config(layout="wide")
|
| 4 |
|
| 5 |
+
margin1, center, margin2 = st.columns([1,9,1])
|
| 6 |
+
|
| 7 |
+
with center:
|
| 8 |
+
|
| 9 |
+
st.title("AI Model Fairness Auditing")
|
| 10 |
|
| 11 |
# --------------------------------------------------
|
| 12 |
# Strategy Definitions
|
| 13 |
# --------------------------------------------------
|
| 14 |
|
| 15 |
model_owner_actions = {
|
| 16 |
+
"Overfit to Audit Dataset": "overfit",
|
| 17 |
+
"Overfit to Audit Dataset-like Distribution": "overfitdist",
|
|
|
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
auditor_actions = {
|
| 21 |
+
"Audit with One Dataset": "auditone",
|
| 22 |
+
"Audit with Multiple Datasets": "auditmany",
|
| 23 |
+
"Use Private Auditing Datasets": "private",
|
| 24 |
+
"Audit Model Internals": "internals",
|
| 25 |
}
|
| 26 |
|
| 27 |
# --------------------------------------------------
|
|
|
|
| 137 |
# Score Calculation
|
| 138 |
# --------------------------------------------------
|
| 139 |
|
| 140 |
+
auditor_active_list = []
|
| 141 |
+
for action in st.session_state.auditor_selected:
|
| 142 |
+
auditor_active_list.append(auditor_actions[action])
|
| 143 |
+
owner_active_list = []
|
| 144 |
+
for action in st.session_state.owner_selected:
|
| 145 |
+
owner_active_list.append(owner_actions[action])
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
auditor_cost = "🟢 Low"
|
| 150 |
+
if "auditmany" in auditor_active_list:
|
| 151 |
+
auditor_cost = "🟡 Medium"
|
| 152 |
+
if "internals" in auditor_active_list:
|
| 153 |
+
auditor_cost = "🔴 High"
|
| 154 |
+
|
| 155 |
+
owner_cost = "None"
|
| 156 |
+
if "overfit" in owner_active_list:
|
| 157 |
+
owner_cost = "🟢 Low"
|
| 158 |
+
if "overfitdist" in owner_active_list:
|
| 159 |
+
owner_cost = "🟡 Medium"
|
| 160 |
+
|
| 161 |
+
reliability
|
| 162 |
+
openness
|
| 163 |
+
|
| 164 |
|
| 165 |
+
owner_current = "none"
|
| 166 |
for action in st.session_state.owner_selected:
|
| 167 |
+
if model_owner_actions[action]=="overfit" and owner_current = "none":
|
| 168 |
+
owner_current = "overfit"
|
| 169 |
+
if model_owner_actions[action]=="overfitdist" and owner_current = "none":
|
| 170 |
+
owner_current = "overfit"
|
| 171 |
+
|
| 172 |
auditor_cost += model_owner_actions[action]["cost"]
|
| 173 |
owner_cost += 10 # simple baseline cost for owner strategies
|
| 174 |
reliability -= model_owner_actions[action]["cheating"]
|