Spaces:
Sleeping
Sleeping
Commit
·
9dee4b2
1
Parent(s):
31dafcd
Fixed app v2
Browse files
app.py
CHANGED
@@ -38,14 +38,14 @@ def predict_threat(log: str, unmasker, topk=5) -> Dict[str, List[Dict[str, Any]]
|
|
38 |
dest_ip_predictions = predictions[4*topk:5*topk]
|
39 |
protocol_predictions = predictions[5*topk:6*topk]
|
40 |
|
41 |
-
# Structure the response in a dictionary
|
42 |
return {
|
43 |
-
"threat_level_predictions": threat_level_predictions,
|
44 |
-
"threat_type_predictions": threat_type_predictions,
|
45 |
-
"attack_type_predictions": attack_type_predictions,
|
46 |
-
"src_ip_predictions": src_ip_predictions,
|
47 |
-
"dest_ip_predictions": dest_ip_predictions,
|
48 |
-
"protocol_predictions": protocol_predictions
|
49 |
}
|
50 |
|
51 |
# FastAPI endpoint for detecting threat level and type for multiple logs
|
|
|
38 |
dest_ip_predictions = predictions[4*topk:5*topk]
|
39 |
protocol_predictions = predictions[5*topk:6*topk]
|
40 |
|
41 |
+
# Structure the response in a dictionary, with each entry containing a list of dictionaries
|
42 |
return {
|
43 |
+
"threat_level_predictions": [pred for pred in threat_level_predictions],
|
44 |
+
"threat_type_predictions": [pred for pred in threat_type_predictions],
|
45 |
+
"attack_type_predictions": [pred for pred in attack_type_predictions],
|
46 |
+
"src_ip_predictions": [pred for pred in src_ip_predictions],
|
47 |
+
"dest_ip_predictions": [pred for pred in dest_ip_predictions],
|
48 |
+
"protocol_predictions": [pred for pred in protocol_predictions]
|
49 |
}
|
50 |
|
51 |
# FastAPI endpoint for detecting threat level and type for multiple logs
|