File size: 814 Bytes
7571df8
 
 
 
a61ef65
7571df8
 
 
 
 
 
 
 
 
 
af7f166
 
 
7571df8
 
 
 
af7f166
1d66ec2
7571df8
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
import pandas as pd
import numpy as np
import pickle
from sklearn.preprocessing import MinMaxScaler

def main():
    st.title('Fraud Detector')

    file = st.file_uploader("Choose a file")

    if file is not None:
        classifier = pickle.load(open('RandomForrestClassifier_df4x.pkl', 'rb'))
        
        df = pd.read_csv(file)
        st.write("The dataset you uploaded is:")
        st.write(df)
        
        for col in ['Class']:
            df = df.loc[:,df.columns != col]
        df = pd.DataFrame(MinMaxScaler().fit(df).transform(df), columns=df.columns)


        result_df = pd.DataFrame(classifier.predict_proba(df))[1]
            
        st.write("Output DataFrame depicting probability of the transaction being fraudulant.")
        st.write(result_df)
    
main()