Spaces:
Sleeping
Sleeping
Commit
·
de1891e
1
Parent(s):
68ebb5b
initial commit
Browse files- Sniffer_AI.py +6 -6
Sniffer_AI.py
CHANGED
|
@@ -9,9 +9,9 @@ from sklearn.tree import DecisionTreeClassifier
|
|
| 9 |
|
| 10 |
# Load the saved models
|
| 11 |
rf_model = joblib.load('rf_model.pkl')
|
| 12 |
-
dt_model = joblib.load('
|
| 13 |
-
bagging_model = joblib.load('
|
| 14 |
-
ada_model = joblib.load('
|
| 15 |
|
| 16 |
class_labels = {
|
| 17 |
0: "normal",
|
|
@@ -34,11 +34,11 @@ def detect_intrusion(features, model_choice="Random Forest"):
|
|
| 34 |
if model_choice == "Random Forest":
|
| 35 |
model = rf_model
|
| 36 |
elif model_choice == "Decision Tree":
|
| 37 |
-
model =
|
| 38 |
elif model_choice == "Bagging Classifier":
|
| 39 |
-
model =
|
| 40 |
elif model_choice == "AdaBoost Classifier":
|
| 41 |
-
model =
|
| 42 |
else:
|
| 43 |
return "Invalid model choice!"
|
| 44 |
|
|
|
|
| 9 |
|
| 10 |
# Load the saved models
|
| 11 |
rf_model = joblib.load('rf_model.pkl')
|
| 12 |
+
dt_model = joblib.load('decision_tree_model.pkl')
|
| 13 |
+
bagging_model = joblib.load('model_bagging.pkl')
|
| 14 |
+
ada_model = joblib.load('model_adaboost.pkl')
|
| 15 |
|
| 16 |
class_labels = {
|
| 17 |
0: "normal",
|
|
|
|
| 34 |
if model_choice == "Random Forest":
|
| 35 |
model = rf_model
|
| 36 |
elif model_choice == "Decision Tree":
|
| 37 |
+
model = decision_tree_model
|
| 38 |
elif model_choice == "Bagging Classifier":
|
| 39 |
+
model = model_bagging
|
| 40 |
elif model_choice == "AdaBoost Classifier":
|
| 41 |
+
model = model_adaboost
|
| 42 |
else:
|
| 43 |
return "Invalid model choice!"
|
| 44 |
|