Download inference.py from avernaut/security-action-verifier: direct link, hf CLI and curl.
- Browser
- Download file 806 Bytes
-
https://huggingface.co/avernaut/security-action-verifier/resolve/main/inference.py
- Command line
-
hf download hf://avernaut/security-action-verifier/inference.py
-
curl -L -o inference.py https://huggingface.co/avernaut/security-action-verifier/resolve/main/inference.py
806 Bytes
| import joblib | |
| GATE_NAMES = [ | |
| "V1_authorization", | |
| "V2_target", | |
| "V3_reachability", | |
| "V4_availability", | |
| "V5_blast_radius", | |
| "V6_effectiveness", | |
| ] | |
| model = joblib.load("model.joblib") | |
| def verify_action(**gates): | |
| values = [int(bool(gates[name])) for name in GATE_NAMES] | |
| prediction = int(model.predict([values])[0]) | |
| failed = [name for name, value in zip(GATE_NAMES, values) if not value] | |
| return { | |
| "verified": bool(prediction), | |
| "decision": "VERIFIED" if prediction else "REJECTED", | |
| "failed_gates": failed, | |
| } | |
| if __name__ == "__main__": | |
| print(verify_action( | |
| V1_authorization=True, | |
| V2_target=True, | |
| V3_reachability=True, | |
| V4_availability=True, | |
| V5_blast_radius=False, | |
| V6_effectiveness=True, | |
| )) | |