IDS_project_app / app.py
dev1461's picture
Create app.py
8740f1f verified
raw
history blame
558 Bytes
import gradio as gr
import numpy as np
def predict(*inputs):
data = np.array(inputs)
# Simple logic (stable)
result = 1 if np.sum(data) > 5 else 0
if result == 1:
return "⚠️ Attack Detected"
else:
return "✅ Normal Traffic"
inputs = [gr.Number(label=f"Feature {i+1}") for i in range(20)]
interface = gr.Interface(
fn=predict,
inputs=inputs,
outputs="text",
title="Intrusion Detection System",
description="Enter feature values to detect attack or normal traffic"
)
interface.launch()