import numpy as np import pickle import warnings import streamlit as st warnings.simplefilter("ignore", UserWarning) model_path = "IF_model_anomaly.pkl" MODEL = pickle.load(open(model_path,'rb')) st.title("Retail Anomaly") st.write(""" An anomaly (also known as an outlier) is when something happens that is outside of the norm, when it stands out or deviates from what is expected. There are different kinds of anomalies in an e-commerce setting, they can be product anomaly, conversion anomaly or marketing anomaly. The model used is Isolation Forest, which is built based on decision trees and is an unsupervised model. Isolation forests can be used to detect anomaly in high dimensional and large datasets, with no labels. """) def prediction(sales,model): sales = np.float64(sales) pred = model.predict(sales.reshape(-1,1))[0] if pred == -1: return "Outlier" else: return "Not outlier" sales = st.number_input("Enter the Sales Value") def fun(): st.header(prediction(sales,MODEL)) if st.button("Predict"): fun() st.write(""" For a detailed description please look through our Documentation """) url = 'https://huggingface.co/spaces/ThirdEyeData/Retail-Anomaly/blob/main/README.md' st.markdown(f''' ''', unsafe_allow_html=True)