Spaces:
Sleeping
Sleeping
qqubb
commited on
Commit
·
eae9bf6
1
Parent(s):
010e00a
check if high_risk in intended purposes
Browse files- compliance_analysis.py +28 -23
compliance_analysis.py
CHANGED
@@ -268,36 +268,41 @@ def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
|
268 |
project_intended_purposes = []
|
269 |
dataset_intended_purposes = []
|
270 |
model_intended_purposes = []
|
|
|
|
|
|
|
|
|
271 |
|
272 |
-
|
273 |
-
|
274 |
-
|
|
|
|
|
|
|
275 |
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
if data_cc['intended_purpose'][f'{key}']['value']:
|
282 |
-
dataset_intended_purposes.append(key)
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
|
288 |
-
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
|
300 |
-
|
301 |
|
302 |
return dispositive_variables
|
303 |
|
|
|
268 |
project_intended_purposes = []
|
269 |
dataset_intended_purposes = []
|
270 |
model_intended_purposes = []
|
271 |
+
|
272 |
+
if dispositive_variables['high_risk_ai_system'] == False:
|
273 |
+
dispositive_variables['msg'].append(f"Not high-risk")
|
274 |
+
return dispositive_variables
|
275 |
|
276 |
+
if dispositive_variables['high_risk_ai_system'] == True:
|
277 |
+
for key in project_cc['high_risk_ai_system']:
|
278 |
+
if project_cc['high_risk_ai_system'][f'{key}']['value']:
|
279 |
+
project_intended_purposes.append(key)
|
280 |
+
|
281 |
+
# For each Data CC, put the intended uses in a set and then make sure the Project's intended use is in the set
|
282 |
|
283 |
+
if other_cc['card_details']['card_type'] == 'data':
|
284 |
+
data_cc = other_cc
|
285 |
+
for key in data_cc['intended_purpose']:
|
286 |
+
if data_cc['intended_purpose'][f'{key}']['value']:
|
287 |
+
dataset_intended_purposes.append(key)
|
|
|
|
|
288 |
|
289 |
+
for purpose in project_intended_purposes:
|
290 |
+
if purpose not in dataset_intended_purposes:
|
291 |
+
dispositive_variables['msg'].append(f"You are not compliant because {purpose} is not a valid purpose for the dataset")
|
292 |
|
293 |
+
# Now do the exact same thing for all models
|
294 |
|
295 |
+
if other_cc['card_details']['card_type'] == 'model':
|
296 |
+
model_cc = other_cc
|
297 |
+
for key in model_cc['intended_purpose']:
|
298 |
+
if model_cc['intended_purpose'][f'{key}']['value']:
|
299 |
+
model_intended_purposes.append(key)
|
300 |
|
301 |
+
for purpose in project_intended_purposes:
|
302 |
+
if purpose not in model_intended_purposes:
|
303 |
+
dispositive_variables['msg'].append(f"You are not compliant because {purpose} is not a valid purpose for the model")
|
304 |
|
305 |
+
dispositive_variables['project_intended_purposes'] = project_intended_purposes
|
306 |
|
307 |
return dispositive_variables
|
308 |
|