MLFinalProject / project_app.py
omar94khan's picture
Upload project_app.py
f464979
raw
history blame contribute delete
No virus
1.02 kB
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()