prakharg24 commited on
Commit
b1543d9
·
verified ·
1 Parent(s): 50fb024

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -82
app.py CHANGED
@@ -2,55 +2,7 @@ import streamlit as st
2
 
3
  st.set_page_config(layout="wide")
4
 
5
- # --------------------------------------------------
6
- # Styling
7
- # --------------------------------------------------
8
-
9
- st.markdown("""
10
- <style>
11
-
12
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');
13
-
14
- html, body, [class*="css"] {
15
- font-family: 'Inter', sans-serif;
16
- }
17
-
18
- /* title styling */
19
- .title {
20
- font-size:42px;
21
- font-weight:600;
22
- margin-bottom:20px;
23
- }
24
-
25
- /* boxes */
26
- .available-box {
27
- background:#f6f7fb;
28
- padding:10px;
29
- border-radius:10px;
30
- border:1px solid #e1e4ef;
31
- }
32
-
33
- .selected-box {
34
- background:#e9f7ef;
35
- padding:10px;
36
- border-radius:10px;
37
- border:1px solid #a7e0b8;
38
- }
39
-
40
- .small-label {
41
- font-size:14px;
42
- color:#666;
43
- margin-bottom:4px;
44
- }
45
-
46
- </style>
47
- """, unsafe_allow_html=True)
48
-
49
- # --------------------------------------------------
50
- # Title
51
- # --------------------------------------------------
52
-
53
- st.markdown('<div class="title">AI Model Fairness Auditing</div>', unsafe_allow_html=True)
54
 
55
  # --------------------------------------------------
56
  # Strategy Definitions
@@ -103,36 +55,31 @@ def toggle_auditor(action):
103
  left, right = st.columns(2)
104
 
105
  # --------------------------------------------------
106
- # MODEL OWNER SIDE
107
  # --------------------------------------------------
108
 
109
  with left:
110
 
111
- st.markdown("### Model Owner")
112
 
113
- st.markdown('<div class="small-label">Chosen</div>', unsafe_allow_html=True)
114
 
115
- selected_box = st.container(border=False)
116
- with selected_box:
117
- st.markdown('<div class="selected-box">', unsafe_allow_html=True)
118
 
119
  for action in st.session_state.owner_selected:
120
  st.button(
121
- action,
122
  key=f"owner_selected_{action}",
123
  on_click=toggle_owner,
124
  args=(action,),
125
  use_container_width=True
126
  )
127
 
128
- st.markdown('</div>', unsafe_allow_html=True)
129
-
130
- st.markdown('<div class="small-label">Available</div>', unsafe_allow_html=True)
131
-
132
- available_box = st.container(border=False)
133
- with available_box:
134
- st.markdown('<div class="available-box">', unsafe_allow_html=True)
135
 
 
136
  for action in model_owner_actions:
137
  if action not in st.session_state.owner_selected:
138
  st.button(
@@ -143,39 +90,32 @@ with left:
143
  use_container_width=True
144
  )
145
 
146
- st.markdown('</div>', unsafe_allow_html=True)
147
-
148
  # --------------------------------------------------
149
- # AUDITOR SIDE
150
  # --------------------------------------------------
151
 
152
  with right:
153
 
154
- st.markdown("### Auditor")
155
 
156
- st.markdown('<div class="small-label">Chosen</div>', unsafe_allow_html=True)
157
 
158
- selected_box = st.container(border=False)
159
- with selected_box:
160
- st.markdown('<div class="selected-box">', unsafe_allow_html=True)
161
 
162
  for action in st.session_state.auditor_selected:
163
  st.button(
164
- action,
165
  key=f"auditor_selected_{action}",
166
  on_click=toggle_auditor,
167
  args=(action,),
168
  use_container_width=True
169
  )
170
 
171
- st.markdown('</div>', unsafe_allow_html=True)
172
-
173
- st.markdown('<div class="small-label">Available</div>', unsafe_allow_html=True)
174
-
175
- available_box = st.container(border=False)
176
- with available_box:
177
- st.markdown('<div class="available-box">', unsafe_allow_html=True)
178
 
 
179
  for action in auditor_actions:
180
  if action not in st.session_state.auditor_selected:
181
  st.button(
@@ -186,8 +126,6 @@ with right:
186
  use_container_width=True
187
  )
188
 
189
- st.markdown('</div>', unsafe_allow_html=True)
190
-
191
  # --------------------------------------------------
192
  # Score Calculation
193
  # --------------------------------------------------
@@ -217,7 +155,7 @@ st.divider()
217
 
218
  c1, c2, c3 = st.columns(3)
219
 
220
- c1.metric("Cheating Chance", f"{cheating}%")
221
  c2.metric("Audit Cost", cost)
222
  c3.metric("Openness Required", open_req)
223
 
 
2
 
3
  st.set_page_config(layout="wide")
4
 
5
+ st.title("AI Model Fairness Auditing")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  # --------------------------------------------------
8
  # Strategy Definitions
 
55
  left, right = st.columns(2)
56
 
57
  # --------------------------------------------------
58
+ # Model Owner
59
  # --------------------------------------------------
60
 
61
  with left:
62
 
63
+ st.subheader("Model Owner")
64
 
65
+ st.caption("Chosen")
66
 
67
+ with st.container(border=True):
68
+ if not st.session_state.owner_selected:
69
+ st.write("None")
70
 
71
  for action in st.session_state.owner_selected:
72
  st.button(
73
+ f"✓ {action}",
74
  key=f"owner_selected_{action}",
75
  on_click=toggle_owner,
76
  args=(action,),
77
  use_container_width=True
78
  )
79
 
80
+ st.caption("Available")
 
 
 
 
 
 
81
 
82
+ with st.container(border=True):
83
  for action in model_owner_actions:
84
  if action not in st.session_state.owner_selected:
85
  st.button(
 
90
  use_container_width=True
91
  )
92
 
 
 
93
  # --------------------------------------------------
94
+ # Auditor
95
  # --------------------------------------------------
96
 
97
  with right:
98
 
99
+ st.subheader("Auditor")
100
 
101
+ st.caption("Chosen")
102
 
103
+ with st.container(border=True):
104
+ if not st.session_state.auditor_selected:
105
+ st.write("None")
106
 
107
  for action in st.session_state.auditor_selected:
108
  st.button(
109
+ f"✓ {action}",
110
  key=f"auditor_selected_{action}",
111
  on_click=toggle_auditor,
112
  args=(action,),
113
  use_container_width=True
114
  )
115
 
116
+ st.caption("Available")
 
 
 
 
 
 
117
 
118
+ with st.container(border=True):
119
  for action in auditor_actions:
120
  if action not in st.session_state.auditor_selected:
121
  st.button(
 
126
  use_container_width=True
127
  )
128
 
 
 
129
  # --------------------------------------------------
130
  # Score Calculation
131
  # --------------------------------------------------
 
155
 
156
  c1, c2, c3 = st.columns(3)
157
 
158
+ c1.metric("Chance of Cheating", f"{cheating}%")
159
  c2.metric("Audit Cost", cost)
160
  c3.metric("Openness Required", open_req)
161