Spaces:
Sleeping
Sleeping
# genesis/safety.py | |
""" | |
Biosecurity & Safety Analysis for GENESIS-AI | |
Checks biosecurity risks using NSABB guidelines + BWC frameworks. | |
""" | |
import re | |
DUAL_USE_KEYWORDS = [ | |
"pathogen", "toxin", "gain of function", "bioweapon", | |
"select agent", "lethal", "infectious dose", "virulence" | |
] | |
def assess_biosecurity_risk(text): | |
""" | |
Returns a biosecurity risk score (0β10) and flagged terms. | |
""" | |
flagged = [kw for kw in DUAL_USE_KEYWORDS if re.search(rf"\b{kw}\b", text, re.IGNORECASE)] | |
score = min(10, len(flagged) * 2) | |
return {"risk_score": score, "flagged_terms": flagged} | |