File size: 806 Bytes
4e9685e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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,
    ))