Spaces:
Sleeping
Sleeping
Commit ·
fb43b33
1
Parent(s): 8fe1e81
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ class_labels = {
|
|
| 38 |
9: "mitm"
|
| 39 |
}
|
| 40 |
|
| 41 |
-
def detect_intrusion(feature_values, label_value, model_choice="Random Forest"):
|
| 42 |
# Ensure the length of feature_values matches feature_names (excluding label)
|
| 43 |
if len(feature_values) != len(feature_names) - 1:
|
| 44 |
return "Please fill in all the required feature values."
|
|
@@ -87,11 +87,11 @@ inputs.append(gr.Dropdown(choices=["Random Forest", "Decision Tree", "Bagging Cl
|
|
| 87 |
# Create the Gradio interface
|
| 88 |
iface = gr.Interface(
|
| 89 |
fn=detect_intrusion,
|
| 90 |
-
inputs=
|
| 91 |
outputs="text",
|
| 92 |
title="Intrusion Detection System",
|
| 93 |
description="Fill in the blank fields for the network traffic features, the label value (0-9), and choose the model to detect intrusions."
|
| 94 |
)
|
| 95 |
|
| 96 |
-
# Launch the interface
|
| 97 |
-
iface.launch(share=True)
|
|
|
|
| 38 |
9: "mitm"
|
| 39 |
}
|
| 40 |
|
| 41 |
+
def detect_intrusion(*feature_values, label_value, model_choice="Random Forest"):
|
| 42 |
# Ensure the length of feature_values matches feature_names (excluding label)
|
| 43 |
if len(feature_values) != len(feature_names) - 1:
|
| 44 |
return "Please fill in all the required feature values."
|
|
|
|
| 87 |
# Create the Gradio interface
|
| 88 |
iface = gr.Interface(
|
| 89 |
fn=detect_intrusion,
|
| 90 |
+
inputs=inputs, # Pass the list of inputs directly
|
| 91 |
outputs="text",
|
| 92 |
title="Intrusion Detection System",
|
| 93 |
description="Fill in the blank fields for the network traffic features, the label value (0-9), and choose the model to detect intrusions."
|
| 94 |
)
|
| 95 |
|
| 96 |
+
# Launch the interface with a public shareable link
|
| 97 |
+
iface.launch(share=True)
|