Spaces:
Sleeping
Sleeping
Upload application files
Browse files- app.py +20 -0
- localoutlierfactor.joblib +3 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
import joblib
|
4 |
+
|
5 |
+
def predict(region1, region2, region3, region4, region5, region6):
|
6 |
+
model = joblib.load('./localoutlierfactor.joblib')
|
7 |
+
print(np.array([[region1, region2, region3, region4, region5, region6]]))
|
8 |
+
ypredict = model.predict(np.array([[region1, region2, region3, region4, region5, region6]]))
|
9 |
+
return "Abnormal traffic" if ypredict == -1 else "Normal traffic"
|
10 |
+
|
11 |
+
app = gr.Interface(
|
12 |
+
title='Traffic Anomaly Detection',
|
13 |
+
fn = predict, # the function that we create to
|
14 |
+
inputs=[gr.Slider(0,800),gr.Slider(0,800),gr.Slider(0,800),
|
15 |
+
gr.Slider(0,800),gr.Slider(0,800),gr.Slider(0,800)], # represent each region inputs
|
16 |
+
outputs='text'
|
17 |
+
)
|
18 |
+
|
19 |
+
# Launch the app
|
20 |
+
app.launch()
|
localoutlierfactor.joblib
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2b2ca0c9629841fbfa394de9e4909c1ba9f68e9c7cf0f5b07ebd24f17abc0688
|
3 |
+
size 63329
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
scikit-learn== 1.2.2
|