Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
st.title("Intrusion Detection System")
|
| 5 |
+
|
| 6 |
+
st.write("Enter input values:")
|
| 7 |
+
|
| 8 |
+
# Example input (adjust size if needed)
|
| 9 |
+
inputs = []
|
| 10 |
+
|
| 11 |
+
for i in range(50): # match your feature count
|
| 12 |
+
val = st.number_input(f"Feature {i+1}", value=0.0)
|
| 13 |
+
inputs.append(val)
|
| 14 |
+
|
| 15 |
+
if st.button("Predict"):
|
| 16 |
+
data = np.array(inputs).reshape(1, -1)
|
| 17 |
+
|
| 18 |
+
prediction = model.predict(data)
|
| 19 |
+
result = int(prediction[0][0] > 0.5)
|
| 20 |
+
|
| 21 |
+
if result == 1:
|
| 22 |
+
st.error("⚠️ Attack Detected")
|
| 23 |
+
else:
|
| 24 |
+
st.success("✅ Normal Traffic")
|