File size: 1,022 Bytes
f464979
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
   
import streamlit as st
import pandas as pd
import numpy as np
import pickle

def main():
    pickle_in = open('RandomForrestClassifier_df1x.pkl', 'rb')
    classifier = pickle.load(pickle_in)
    
    columns = ["V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10",
    "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19", "V20",
    "V21", "V22", "V23", "V24", "V25", "V26", "V27", "V28", "Amount"]

    st.title('Fraud Detector')
    for i in columns:
        i = st.number_input("Please input the "+i+" value here.")
    submit = st.button('Calculate')
        
    input = [[V1, V2, V3, V4, V5, V6, V7, V8, V9, V10,
            V11, V12, V13, V14, V15, V16, V17, V18, V19, V20,
            V21, V22, V23, V24, V25, V26, V27, V28, Amount]]

    input_df = pd.DataFrame(input, columns=columns)
    
    prediction = classifier.predict(input_df)


    if prediction == 1:
        st.write("The transaction is fraudulant.")
        
    else:
        st.write("The transaction is normal.")
    
main()