7jimmy's picture
Create app.py
f940ff0 verified
import streamlit as st
import pandas as pd
import numpy as np
def detect_anomalies(df, threshold):
"""
Detects users with login attempts exceeding the threshold.
Args:
- df: DataFrame containing user activity data.
- threshold: Number of login attempts to consider as anomalous.
Returns:
- DataFrame of detected anomalies.
"""
anomalies = df[df['login_attempts'] > threshold]
return anomalies
# Streamlit app layout
st.title('User and Entity Behavior Analytics (UEBA)')
# File uploader
uploaded_file = st.file_uploader("Upload your CSV file", type="csv")
# Threshold input
threshold = st.slider("Set anomaly detection threshold", min_value=1, max_value=10, value=3)
if uploaded_file is not None:
df = pd.read_csv(uploaded_file)
if st.button('Detect Anomalies'):
anomalies = detect_anomalies(df, threshold)
if not anomalies.empty:
st.write("Detected Anomalies:")
st.dataframe(anomalies)
else:
st.write("No anomalies detected with the current threshold.")