prakharg24 commited on
Commit
830a775
·
verified ·
1 Parent(s): 4d528b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +138 -16
app.py CHANGED
@@ -1,17 +1,139 @@
1
  import streamlit as st
2
- from my_pages import landing, txt_pages, conclusion, bibliography
3
- from my_pages import information_loss, rashomon_effect, rashomon_developer, developer_decisions, ica, multiverse
4
-
5
- # --- Configure the app ---
6
- # st.set_page_config(page_title="Multiplicity Interactive Demo", layout="centered")
7
- st.set_page_config(page_title="Multiplicity Interactive Demo")
8
-
9
- # --- Initialize session state ---
10
- if "page" not in st.session_state:
11
- st.session_state.page = "landing"
12
-
13
- if "txt_" in st.session_state.page:
14
- txt_pages.render()
15
- else:
16
- page_obj = globals().get(st.session_state.page)
17
- page_obj.render()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+
3
+ st.set_page_config(layout="wide")
4
+
5
+ st.title("AI Model Auditing Strategy Simulator")
6
+
7
+ st.markdown(
8
+ """
9
+ Select actions taken by the **Model Owner** and the **Auditor**.
10
+ The dashboard will update to estimate:
11
+
12
+ - Probability the model owner can cheat the audit
13
+ - Cost of auditing
14
+ - Level of openness required
15
+ """
16
+ )
17
+
18
+ # -------------------------
19
+ # Strategy Definitions
20
+ # -------------------------
21
+
22
+ model_owner_actions = {
23
+ "Fine-tuning / overfitting on auditing test": {
24
+ "cheating": 25,
25
+ "cost": 0,
26
+ "openness": -5
27
+ },
28
+ "Fine-tuning on auditing-like data distribution": {
29
+ "cheating": 20,
30
+ "cost": 0,
31
+ "openness": -3
32
+ },
33
+ "Training a special audit-behavior mode": {
34
+ "cheating": 30,
35
+ "cost": 5,
36
+ "openness": -10
37
+ },
38
+ "Withholding training details": {
39
+ "cheating": 15,
40
+ "cost": 0,
41
+ "openness": -15
42
+ }
43
+ }
44
+
45
+ auditor_actions = {
46
+ "Audit on one dataset": {
47
+ "cheating": 20,
48
+ "cost": 10,
49
+ "openness": 5
50
+ },
51
+ "Audit on multiple datasets": {
52
+ "cheating": -15,
53
+ "cost": 25,
54
+ "openness": 10
55
+ },
56
+ "Request internal model access": {
57
+ "cheating": -25,
58
+ "cost": 30,
59
+ "openness": 30
60
+ },
61
+ "Request training data documentation": {
62
+ "cheating": -10,
63
+ "cost": 5,
64
+ "openness": 20
65
+ }
66
+ }
67
+
68
+ # -------------------------
69
+ # Layout
70
+ # -------------------------
71
+
72
+ left, right = st.columns(2)
73
+
74
+ with left:
75
+ st.header("Model Owner Actions")
76
+
77
+ selected_owner = st.multiselect(
78
+ "Choose actions:",
79
+ list(model_owner_actions.keys())
80
+ )
81
+
82
+ with right:
83
+ st.header("Auditor Actions")
84
+
85
+ selected_auditor = st.multiselect(
86
+ "Choose actions:",
87
+ list(auditor_actions.keys())
88
+ )
89
+
90
+ # -------------------------
91
+ # Score Calculation
92
+ # -------------------------
93
+
94
+ cheating_score = 50
95
+ audit_cost = 0
96
+ openness_required = 0
97
+
98
+ for action in selected_owner:
99
+ cheating_score += model_owner_actions[action]["cheating"]
100
+ audit_cost += model_owner_actions[action]["cost"]
101
+ openness_required += model_owner_actions[action]["openness"]
102
+
103
+ for action in selected_auditor:
104
+ cheating_score += auditor_actions[action]["cheating"]
105
+ audit_cost += auditor_actions[action]["cost"]
106
+ openness_required += auditor_actions[action]["openness"]
107
+
108
+ cheating_score = max(0, min(100, cheating_score))
109
+ openness_required = max(0, openness_required)
110
+
111
+ # -------------------------
112
+ # Dashboard
113
+ # -------------------------
114
+
115
+ st.divider()
116
+ st.subheader("Audit Outcome Dashboard")
117
+
118
+ col1, col2, col3 = st.columns(3)
119
+
120
+ col1.metric(
121
+ "Chance of Cheating",
122
+ f"{cheating_score}%"
123
+ )
124
+
125
+ col2.metric(
126
+ "Audit Cost",
127
+ audit_cost
128
+ )
129
+
130
+ col3.metric(
131
+ "Openness Required",
132
+ openness_required
133
+ )
134
+
135
+ # -------------------------
136
+ # Optional Visualization
137
+ # -------------------------
138
+
139
+ st.progress(cheating_score / 100)