Spaces:
Sleeping
Sleeping
import gradio as gr | |
import numpy as np | |
import joblib | |
def predict(region1, region2, region3, region4, region5, region6): | |
model = joblib.load('./localoutlierfactor.joblib') | |
print(np.array([[region1, region2, region3, region4, region5, region6]])) | |
ypredict = model.predict(np.array([[region1, region2, region3, region4, region5, region6]])) | |
return "Abnormal traffic" if ypredict == -1 else "Normal traffic" | |
app = gr.Interface( | |
title='Traffic Anomaly Detection', | |
fn = predict, # the function that we create to | |
inputs=[gr.Slider(0,800),gr.Slider(0,800),gr.Slider(0,800), | |
gr.Slider(0,800),gr.Slider(0,800),gr.Slider(0,800)], # represent each region inputs | |
outputs='text' | |
) | |
# Launch the app | |
app.launch() | |