Spaces:
Sleeping
Sleeping
qqubb commited on
Commit ·
600ad18
1
Parent(s): 44e63cc
more card specific messages
Browse files- __pycache__/compliance_analysis.cpython-310.pyc +0 -0
- __pycache__/utils.cpython-310.pyc +0 -0
- compliance_analysis.py +51 -36
- utils.py +3 -3
__pycache__/compliance_analysis.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/compliance_analysis.cpython-310.pyc and b/__pycache__/compliance_analysis.cpython-310.pyc differ
|
|
|
__pycache__/utils.cpython-310.pyc
CHANGED
|
Binary files a/__pycache__/utils.cpython-310.pyc and b/__pycache__/utils.cpython-310.pyc differ
|
|
|
compliance_analysis.py
CHANGED
|
@@ -28,11 +28,11 @@ def check_overall_compliance_ui(cards):
|
|
| 28 |
},
|
| 29 |
"project_intended_purposes": [],
|
| 30 |
"project_cc_pass": False,
|
|
|
|
| 31 |
"data_cc_compliant": [],
|
| 32 |
"model_cc_compliant": [],
|
| 33 |
"data_cc_non-compliant": {},
|
| 34 |
"model_cc_non-compliant": {},
|
| 35 |
-
"msg": []
|
| 36 |
}
|
| 37 |
|
| 38 |
if any(item['value'] for item in project_cc['high_risk_ai_system'].values()) == True:
|
|
@@ -86,7 +86,7 @@ def check_overall_compliance(cards):
|
|
| 86 |
"project_cc_pass": False,
|
| 87 |
"data_cc_pass": False,
|
| 88 |
"model_cc_pass": False,
|
| 89 |
-
"
|
| 90 |
}
|
| 91 |
|
| 92 |
# check intended purposes
|
|
@@ -123,7 +123,7 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
|
|
| 123 |
if project_cc_yaml['gpai_model']['gpai_model']['value']:
|
| 124 |
dispositive_variables['ai_project_type']['gpai_model'] = True
|
| 125 |
if project_cc_yaml['ai_system']['ai_system']['value'] == True and project_cc_yaml['gpai_model']['gpai_model']['value'] == True:
|
| 126 |
-
dispositive_variables['
|
| 127 |
return dispositive_variables
|
| 128 |
|
| 129 |
if dispositive_variables['ai_project_type']['ai_system'] == True:
|
|
@@ -148,23 +148,23 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
|
|
| 148 |
|
| 149 |
# Check if project is within scope of the Compliance Cards project. If not, inform user.
|
| 150 |
if project_cc_yaml['operator_details']['provider']['value'] == True:
|
| 151 |
-
dispositive_variables['
|
| 152 |
else:
|
| 153 |
-
dispositive_variables['
|
| 154 |
dispositive_variables['project_cc_pass'] = True
|
| 155 |
return dispositive_variables
|
| 156 |
|
| 157 |
# Check if the project is within scope of the Act. If it's not, the analysis is over.
|
| 158 |
if check_within_scope_act(dispositive_variables, project_cc_yaml):
|
| 159 |
-
dispositive_variables['
|
| 160 |
else:
|
| 161 |
-
dispositive_variables['
|
| 162 |
dispositive_variables['project_cc_pass'] = True
|
| 163 |
return dispositive_variables
|
| 164 |
|
| 165 |
# Check for prohibited practices. If any exist, the analysis is over.
|
| 166 |
if check_prohibited(project_cc_yaml) == True:
|
| 167 |
-
dispositive_variables['
|
| 168 |
return dispositive_variables
|
| 169 |
else:
|
| 170 |
print("Project does not contain prohibited practies. Let's continue...")
|
|
@@ -174,81 +174,92 @@ def run_compliance_analysis_on_project(dispositive_variables, project_cc_yaml):
|
|
| 174 |
|
| 175 |
for key in project_cc_yaml['risk_management_system']:
|
| 176 |
if project_cc_yaml['risk_management_system'][f'{key}']['value'] == True:
|
| 177 |
-
dispositive_variables['
|
| 178 |
for key in project_cc_yaml['technical_documentation']:
|
| 179 |
if project_cc_yaml['technical_documentation'][f'{key}']['value'] == True:
|
| 180 |
-
dispositive_variables['
|
| 181 |
|
| 182 |
for key in project_cc_yaml['record_keeping']:
|
| 183 |
if project_cc_yaml['record_keeping'][f'{key}']['value'] == True:
|
| 184 |
-
dispositive_variables['
|
| 185 |
|
| 186 |
for key in project_cc_yaml['transparency_and_provision_of_information_to_deployers']:
|
| 187 |
if project_cc_yaml['transparency_and_provision_of_information_to_deployers'][f'{key}']['value'] == True:
|
| 188 |
-
dispositive_variables['
|
| 189 |
|
| 190 |
for key in project_cc_yaml['human_oversight']:
|
| 191 |
if project_cc_yaml['human_oversight'][f'{key}']['value'] == True:
|
| 192 |
-
dispositive_variables['
|
| 193 |
|
| 194 |
for key in project_cc_yaml['accuracy_robustness_cybersecurity']:
|
| 195 |
if project_cc_yaml['accuracy_robustness_cybersecurity'][f'{key}']['value'] == True:
|
| 196 |
-
dispositive_variables['
|
| 197 |
|
| 198 |
for key in project_cc_yaml['quality_management_system']:
|
| 199 |
if project_cc_yaml['quality_management_system'][f'{key}']['value'] == True:
|
| 200 |
-
dispositive_variables['
|
| 201 |
|
| 202 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 203 |
|
| 204 |
if dispositive_variables['ai_project_type']["gpai_model_systemic_risk"] == True:
|
| 205 |
for key in project_cc_yaml['gpai_models_with_systemic_risk_obligations']:
|
| 206 |
if project_cc_yaml['gpai_models_with_systemic_risk_obligations'][f'{key}']['value'] == True:
|
| 207 |
-
dispositive_variables['
|
| 208 |
|
| 209 |
for obligation_cat in project_cc_yaml['gpai_model_obligations']:
|
| 210 |
for obligation in project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}']:
|
| 211 |
if project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}'][f'{obligation}']['value'] == True:
|
| 212 |
-
dispositive_variables['
|
| 213 |
|
| 214 |
return dispositive_variables
|
| 215 |
|
| 216 |
def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
| 219 |
for key in data_cc_yaml['high_risk_ai_system_requirements']:
|
| 220 |
if data_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['value'] == True:
|
| 221 |
-
dispositive_variables['msg'].append(f"This high-risk AI system fails the {key} requirements under {data_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['article']}.")
|
| 222 |
-
|
| 223 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 224 |
for value in data_cc_yaml['gpai_model_requirements']:
|
| 225 |
if data_cc_yaml['gpai_model_requirements'][f'{value}'] == True:
|
| 226 |
-
dispositive_variables['msg'].append(f"")
|
| 227 |
|
| 228 |
return dispositive_variables
|
| 229 |
|
| 230 |
def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
# If project involves a high-risk AI system, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 233 |
|
| 234 |
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
| 235 |
for value in model_cc_yaml['high_risk_ai_system_requirements']:
|
| 236 |
if model_cc_yaml['high_risk_ai_system_requirements'][f'{value}'] == True:
|
| 237 |
-
dispositive_variables['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['article']}.")
|
|
|
|
| 238 |
|
| 239 |
# If project involves a GPAI model, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 240 |
|
| 241 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 242 |
for key in model_cc_yaml['gpai_model_requirements']:
|
| 243 |
if model_cc_yaml['gpai_model_requirements'][f'{key}']['value'] == True:
|
| 244 |
-
dispositive_variables['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['gpai_model_requirements'][f'{key}']['article']}.")
|
|
|
|
| 245 |
|
| 246 |
# If the GPAI model additionally carries systemic risk, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 247 |
|
| 248 |
if dispositive_variables['ai_project_type']["gpai_model_systemic_risk"] == True:
|
| 249 |
for key in model_cc_yaml['gpai_model_with_systemic_risk_requirements']:
|
| 250 |
if model_cc_yaml['gpai_model_with_systemic_risk_requirements'][f'{key}']['value'] == True:
|
| 251 |
-
dispositive_variables['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['gpai_model_with_systemic_risk_requirements'][f'{key}']['article']}.")
|
|
|
|
| 252 |
|
| 253 |
return dispositive_variables
|
| 254 |
|
|
@@ -259,7 +270,7 @@ def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
|
| 259 |
model_intended_purposes = []
|
| 260 |
|
| 261 |
if dispositive_variables['ai_project_type']['high_risk_ai_system'] == False:
|
| 262 |
-
dispositive_variables['
|
| 263 |
return dispositive_variables
|
| 264 |
|
| 265 |
if dispositive_variables['ai_project_type']['high_risk_ai_system'] == True:
|
|
@@ -272,18 +283,20 @@ def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
|
| 272 |
if other_cc['card_details']['card_type'] == 'data':
|
| 273 |
data_cc = other_cc
|
| 274 |
card_label = data_cc['card_details']['card_label']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
for key in data_cc['intended_purpose']:
|
| 276 |
if data_cc['intended_purpose'][f'{key}']['value']:
|
| 277 |
dataset_intended_purposes.append(key)
|
| 278 |
|
| 279 |
for purpose in project_intended_purposes:
|
| 280 |
if purpose not in dataset_intended_purposes:
|
| 281 |
-
# dispositive_variables['
|
| 282 |
-
if not
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
}
|
| 286 |
-
dispositive_variables['data_cc_non-compliant'][card_label]['intended_purpose'].append((f"{purpose}"))
|
| 287 |
else:
|
| 288 |
dispositive_variables['data_cc_compliant'].append(data_cc['card_details']['card_label'])
|
| 289 |
|
|
@@ -292,18 +305,20 @@ def check_intended_purpose(dispositive_variables, project_cc, other_cc):
|
|
| 292 |
if other_cc['card_details']['card_type'] == 'model':
|
| 293 |
model_cc = other_cc
|
| 294 |
card_label = model_cc['card_details']['card_label']
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
for key in model_cc['intended_purpose']:
|
| 296 |
if model_cc['intended_purpose'][f'{key}']['value']:
|
| 297 |
model_intended_purposes.append(key)
|
| 298 |
|
| 299 |
for purpose in project_intended_purposes:
|
| 300 |
if purpose not in model_intended_purposes:
|
| 301 |
-
# dispositive_variables['
|
| 302 |
-
if not
|
| 303 |
-
dispositive_variables['model_cc_non-compliant'][card_label] =
|
| 304 |
-
|
| 305 |
-
}
|
| 306 |
-
dispositive_variables['model_cc_non-compliant'][card_label]['intended_purpose'].append((f"{purpose}"))
|
| 307 |
else:
|
| 308 |
dispositive_variables['model_cc_compliant'].append(model_cc['card_details']['card_label'])
|
| 309 |
|
|
|
|
| 28 |
},
|
| 29 |
"project_intended_purposes": [],
|
| 30 |
"project_cc_pass": False,
|
| 31 |
+
"project_msg": [],
|
| 32 |
"data_cc_compliant": [],
|
| 33 |
"model_cc_compliant": [],
|
| 34 |
"data_cc_non-compliant": {},
|
| 35 |
"model_cc_non-compliant": {},
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
if any(item['value'] for item in project_cc['high_risk_ai_system'].values()) == True:
|
|
|
|
| 86 |
"project_cc_pass": False,
|
| 87 |
"data_cc_pass": False,
|
| 88 |
"model_cc_pass": False,
|
| 89 |
+
"project_msg": []
|
| 90 |
}
|
| 91 |
|
| 92 |
# check intended purposes
|
|
|
|
| 123 |
if project_cc_yaml['gpai_model']['gpai_model']['value']:
|
| 124 |
dispositive_variables['ai_project_type']['gpai_model'] = True
|
| 125 |
if project_cc_yaml['ai_system']['ai_system']['value'] == True and project_cc_yaml['gpai_model']['gpai_model']['value'] == True:
|
| 126 |
+
dispositive_variables['project_msg'].append("Your project cannot be both an AI system and a GPAI model. Please revise your Project CC accordingly.")
|
| 127 |
return dispositive_variables
|
| 128 |
|
| 129 |
if dispositive_variables['ai_project_type']['ai_system'] == True:
|
|
|
|
| 148 |
|
| 149 |
# Check if project is within scope of the Compliance Cards project. If not, inform user.
|
| 150 |
if project_cc_yaml['operator_details']['provider']['value'] == True:
|
| 151 |
+
dispositive_variables['project_msg'].append("Project is within the scope of the Compliance Cards system. Let's continue...")
|
| 152 |
else:
|
| 153 |
+
# dispositive_variables['project_msg'].append("Project is not within the scope of the initial version of the Compliance Cards system.")
|
| 154 |
dispositive_variables['project_cc_pass'] = True
|
| 155 |
return dispositive_variables
|
| 156 |
|
| 157 |
# Check if the project is within scope of the Act. If it's not, the analysis is over.
|
| 158 |
if check_within_scope_act(dispositive_variables, project_cc_yaml):
|
| 159 |
+
dispositive_variables['project_msg'].append("Project is within the scope of Act. Let's continue...")
|
| 160 |
else:
|
| 161 |
+
# dispositive_variables['project_msg'].append("Project is not within the scope of what is regulated by the Act.")
|
| 162 |
dispositive_variables['project_cc_pass'] = True
|
| 163 |
return dispositive_variables
|
| 164 |
|
| 165 |
# Check for prohibited practices. If any exist, the analysis is over.
|
| 166 |
if check_prohibited(project_cc_yaml) == True:
|
| 167 |
+
dispositive_variables['project_msg'].append("Project is non-compliant due to a prohibited practice.")
|
| 168 |
return dispositive_variables
|
| 169 |
else:
|
| 170 |
print("Project does not contain prohibited practies. Let's continue...")
|
|
|
|
| 174 |
|
| 175 |
for key in project_cc_yaml['risk_management_system']:
|
| 176 |
if project_cc_yaml['risk_management_system'][f'{key}']['value'] == True:
|
| 177 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 9.")
|
| 178 |
for key in project_cc_yaml['technical_documentation']:
|
| 179 |
if project_cc_yaml['technical_documentation'][f'{key}']['value'] == True:
|
| 180 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 11.")
|
| 181 |
|
| 182 |
for key in project_cc_yaml['record_keeping']:
|
| 183 |
if project_cc_yaml['record_keeping'][f'{key}']['value'] == True:
|
| 184 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the risk management requirements under Article 12.")
|
| 185 |
|
| 186 |
for key in project_cc_yaml['transparency_and_provision_of_information_to_deployers']:
|
| 187 |
if project_cc_yaml['transparency_and_provision_of_information_to_deployers'][f'{key}']['value'] == True:
|
| 188 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the transparency requirements under Article 13.")
|
| 189 |
|
| 190 |
for key in project_cc_yaml['human_oversight']:
|
| 191 |
if project_cc_yaml['human_oversight'][f'{key}']['value'] == True:
|
| 192 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the human oversight requirements under Article 14.")
|
| 193 |
|
| 194 |
for key in project_cc_yaml['accuracy_robustness_cybersecurity']:
|
| 195 |
if project_cc_yaml['accuracy_robustness_cybersecurity'][f'{key}']['value'] == True:
|
| 196 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 15.")
|
| 197 |
|
| 198 |
for key in project_cc_yaml['quality_management_system']:
|
| 199 |
if project_cc_yaml['quality_management_system'][f'{key}']['value'] == True:
|
| 200 |
+
dispositive_variables['project_msg'].append("Because of project-level characteristics, this high-risk AI system fails the accuracy, robustness, and cybersecurity requirements under Article 17.")
|
| 201 |
|
| 202 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 203 |
|
| 204 |
if dispositive_variables['ai_project_type']["gpai_model_systemic_risk"] == True:
|
| 205 |
for key in project_cc_yaml['gpai_models_with_systemic_risk_obligations']:
|
| 206 |
if project_cc_yaml['gpai_models_with_systemic_risk_obligations'][f'{key}']['value'] == True:
|
| 207 |
+
dispositive_variables['project_msg'].append("GPAI model with systematic risk fails the transparency requirements under Article 55.")
|
| 208 |
|
| 209 |
for obligation_cat in project_cc_yaml['gpai_model_obligations']:
|
| 210 |
for obligation in project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}']:
|
| 211 |
if project_cc_yaml['gpai_model_obligations'][f'{obligation_cat}'][f'{obligation}']['value'] == True:
|
| 212 |
+
dispositive_variables['project_msg'].append("GPAI model fails the transparency requirements under Article 53.")
|
| 213 |
|
| 214 |
return dispositive_variables
|
| 215 |
|
| 216 |
def run_compliance_analysis_on_data(dispositive_variables, data_cc_yaml):
|
| 217 |
|
| 218 |
+
card_label = data_cc_yaml['card_details']['card_label']
|
| 219 |
+
if not card_label in dispositive_variables['data_cc_non-compliant']:
|
| 220 |
+
dispositive_variables['data_cc_non-compliant'][card_label] = {"msg": []}
|
| 221 |
+
|
| 222 |
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
| 223 |
for key in data_cc_yaml['high_risk_ai_system_requirements']:
|
| 224 |
if data_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['value'] == True:
|
| 225 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['msg'].append(f"This high-risk AI system fails the {key} requirements under {data_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['article']}.")
|
| 226 |
+
dispositive_variables['project_cc_pass'] = False
|
| 227 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 228 |
for value in data_cc_yaml['gpai_model_requirements']:
|
| 229 |
if data_cc_yaml['gpai_model_requirements'][f'{value}'] == True:
|
| 230 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['msg'].append(f"")
|
| 231 |
|
| 232 |
return dispositive_variables
|
| 233 |
|
| 234 |
def run_compliance_analysis_on_model(dispositive_variables, model_cc_yaml):
|
| 235 |
+
|
| 236 |
+
card_label = model_cc_yaml['card_details']['card_label']
|
| 237 |
+
if not card_label in dispositive_variables['model_cc_non-compliant']:
|
| 238 |
+
dispositive_variables['data_cc_non-compliant'][card_label] = {"msg": []}
|
| 239 |
|
| 240 |
# If project involves a high-risk AI system, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 241 |
|
| 242 |
if dispositive_variables['ai_project_type']["high_risk_ai_system"] == True:
|
| 243 |
for value in model_cc_yaml['high_risk_ai_system_requirements']:
|
| 244 |
if model_cc_yaml['high_risk_ai_system_requirements'][f'{value}'] == True:
|
| 245 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['high_risk_ai_system_requirements'][f'{key}']['article']}.")
|
| 246 |
+
dispositive_variables['project_cc_pass'] = False
|
| 247 |
|
| 248 |
# If project involves a GPAI model, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 249 |
|
| 250 |
if dispositive_variables['ai_project_type']["gpai_model"] == True:
|
| 251 |
for key in model_cc_yaml['gpai_model_requirements']:
|
| 252 |
if model_cc_yaml['gpai_model_requirements'][f'{key}']['value'] == True:
|
| 253 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['gpai_model_requirements'][f'{key}']['article']}.")
|
| 254 |
+
dispositive_variables['project_cc_pass'] = False
|
| 255 |
|
| 256 |
# If the GPAI model additionally carries systemic risk, then make sure all the relevant model requirements are met (relevant attributes are positive)
|
| 257 |
|
| 258 |
if dispositive_variables['ai_project_type']["gpai_model_systemic_risk"] == True:
|
| 259 |
for key in model_cc_yaml['gpai_model_with_systemic_risk_requirements']:
|
| 260 |
if model_cc_yaml['gpai_model_with_systemic_risk_requirements'][f'{key}']['value'] == True:
|
| 261 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['msg'].append(f"This high-risk AI system fails the {key} requirements under {model_cc_yaml['gpai_model_with_systemic_risk_requirements'][f'{key}']['article']}.")
|
| 262 |
+
dispositive_variables['project_cc_pass'] = False
|
| 263 |
|
| 264 |
return dispositive_variables
|
| 265 |
|
|
|
|
| 270 |
model_intended_purposes = []
|
| 271 |
|
| 272 |
if dispositive_variables['ai_project_type']['high_risk_ai_system'] == False:
|
| 273 |
+
dispositive_variables['project_msg'].append(f"not high-risk")
|
| 274 |
return dispositive_variables
|
| 275 |
|
| 276 |
if dispositive_variables['ai_project_type']['high_risk_ai_system'] == True:
|
|
|
|
| 283 |
if other_cc['card_details']['card_type'] == 'data':
|
| 284 |
data_cc = other_cc
|
| 285 |
card_label = data_cc['card_details']['card_label']
|
| 286 |
+
|
| 287 |
+
if not card_label in dispositive_variables['data_cc_non-compliant']:
|
| 288 |
+
dispositive_variables['data_cc_non-compliant'][card_label] = {"msg": []}
|
| 289 |
+
|
| 290 |
for key in data_cc['intended_purpose']:
|
| 291 |
if data_cc['intended_purpose'][f'{key}']['value']:
|
| 292 |
dataset_intended_purposes.append(key)
|
| 293 |
|
| 294 |
for purpose in project_intended_purposes:
|
| 295 |
if purpose not in dataset_intended_purposes:
|
| 296 |
+
# dispositive_variables['project_msg'].append(f"You are not compliant because {purpose} is not a valid purpose for {data_cc['card_details']['card_label']}")
|
| 297 |
+
if not "intended_purpose" in dispositive_variables['data_cc_non-compliant'][card_label]:
|
| 298 |
+
dispositive_variables['data_cc_non-compliant'][card_label]["intended_purpose"] = []
|
| 299 |
+
dispositive_variables['data_cc_non-compliant'][card_label]['intended_purpose'].append((f"{purpose}"))
|
|
|
|
|
|
|
| 300 |
else:
|
| 301 |
dispositive_variables['data_cc_compliant'].append(data_cc['card_details']['card_label'])
|
| 302 |
|
|
|
|
| 305 |
if other_cc['card_details']['card_type'] == 'model':
|
| 306 |
model_cc = other_cc
|
| 307 |
card_label = model_cc['card_details']['card_label']
|
| 308 |
+
|
| 309 |
+
if not card_label in dispositive_variables['model_cc_non-compliant']:
|
| 310 |
+
dispositive_variables['model_cc_non-compliant'][card_label] = {"msg": []}
|
| 311 |
+
|
| 312 |
for key in model_cc['intended_purpose']:
|
| 313 |
if model_cc['intended_purpose'][f'{key}']['value']:
|
| 314 |
model_intended_purposes.append(key)
|
| 315 |
|
| 316 |
for purpose in project_intended_purposes:
|
| 317 |
if purpose not in model_intended_purposes:
|
| 318 |
+
# dispositive_variables['project_msg'].append(f"You are not compliant because {purpose} is not a valid purpose for {model_cc['card_details']['card_label']}")
|
| 319 |
+
if not "intended_purpose" in dispositive_variables['model_cc_non-compliant'][card_label]:
|
| 320 |
+
dispositive_variables['model_cc_non-compliant'][card_label]["intended_purpose"] = []
|
| 321 |
+
dispositive_variables['model_cc_non-compliant'][card_label]['intended_purpose'].append((f"{purpose}"))
|
|
|
|
|
|
|
| 322 |
else:
|
| 323 |
dispositive_variables['model_cc_compliant'].append(model_cc['card_details']['card_label'])
|
| 324 |
|
utils.py
CHANGED
|
@@ -12,9 +12,9 @@ def set_operator_role_and_location(dispositive_variables, project_cc_yaml):
|
|
| 12 |
operators += 1
|
| 13 |
|
| 14 |
if ai_system and gpai_model:
|
| 15 |
-
dispositive_variables['
|
| 16 |
if operators != 1:
|
| 17 |
-
dispositive_variables['
|
| 18 |
|
| 19 |
return dispositive_variables
|
| 20 |
|
|
@@ -63,7 +63,7 @@ def check_excepted(dispositive_variables, project_cc_yaml):
|
|
| 63 |
project_cc_yaml['excepted']['open_source_gpai_model']['value'] == True and
|
| 64 |
dispositive_variables['ai_project_type']['gpai_model_systemic_risk'] == False)
|
| 65 |
):
|
| 66 |
-
dispositive_variables['
|
| 67 |
return True
|
| 68 |
else:
|
| 69 |
return False
|
|
|
|
| 12 |
operators += 1
|
| 13 |
|
| 14 |
if ai_system and gpai_model:
|
| 15 |
+
dispositive_variables['project_msg'].append("Your project cannot be both an AI system and a GPAI model. Please revise your Project CC accordingly.")
|
| 16 |
if operators != 1:
|
| 17 |
+
dispositive_variables['project_msg'].append("Please specify exactly one operator role.")
|
| 18 |
|
| 19 |
return dispositive_variables
|
| 20 |
|
|
|
|
| 63 |
project_cc_yaml['excepted']['open_source_gpai_model']['value'] == True and
|
| 64 |
dispositive_variables['ai_project_type']['gpai_model_systemic_risk'] == False)
|
| 65 |
):
|
| 66 |
+
dispositive_variables['project_msg'].append("Your project falls into one of the exemptions from the Act.")
|
| 67 |
return True
|
| 68 |
else:
|
| 69 |
return False
|