Spaces:
Sleeping
Sleeping
Commit
·
44fda73
1
Parent(s):
978b2fe
Solved classify_risk
Browse files- utils/logger.py +9 -0
utils/logger.py
CHANGED
|
@@ -10,6 +10,15 @@ import numpy as np
|
|
| 10 |
LOG_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "logs"))
|
| 11 |
os.makedirs(LOG_DIR, exist_ok=True)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
BCC_LOG_FILE = os.path.join(LOG_DIR, "bcc_logs.csv")
|
| 14 |
CICIDS_LOG_FILE = os.path.join(LOG_DIR, "cicids_logs.csv")
|
| 15 |
|
|
|
|
| 10 |
LOG_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "logs"))
|
| 11 |
os.makedirs(LOG_DIR, exist_ok=True)
|
| 12 |
|
| 13 |
+
# ADD THESE TWO LINES:
|
| 14 |
+
LOG_FILE = os.path.join(LOG_DIR, "bcc_logs.csv") # Fallback to BCC log
|
| 15 |
+
|
| 16 |
+
def classify_risk(score):
|
| 17 |
+
"""Simple helper to convert numeric score to text for the UI"""
|
| 18 |
+
if score > 0.8: return "High"
|
| 19 |
+
if score > 0.4: return "Medium"
|
| 20 |
+
return "Low"
|
| 21 |
+
|
| 22 |
BCC_LOG_FILE = os.path.join(LOG_DIR, "bcc_logs.csv")
|
| 23 |
CICIDS_LOG_FILE = os.path.join(LOG_DIR, "cicids_logs.csv")
|
| 24 |
|