-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFraud_detection.py
More file actions
38 lines (28 loc) · 1.2 KB
/
Copy pathFraud_detection.py
File metadata and controls
38 lines (28 loc) · 1.2 KB
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
36
37
38
import streamlit as st
import pandas as pd
import joblib
model = joblib.load("fraud_detection_pipeline.pkt")
st.title("Fraud Detection prediction App")
st.markdown("please enter the Transaction Details and use the Predict button ")
st.divider()
transaction_type=st.selectbox("Transaction Type",["PAYMENT","TRANSFER","CASH_OUT","DEPOSIT"])
amount=st.number_input("Amount",min_value=0.0,value=1000.0)
oldbalanceOrg=st.number_input(" Old Balance (Sender)",min_value=0.0,value=10000.0)
newbalanceOrig=st.number_input(" New Balance (Sender)",min_value=0.0,value=9000.0)
oldbalanceDest=st.number_input(" Old Balance (Receiver)",min_value=0.0,value=0.0)
newbalanceDest=st.number_input(" New Balance (Receiver)",min_value=0.0,value=0.0)
if st.button("Predict"):
input_data=pd.DataFrame([{
"type": transaction_type,
"amount": amount,
"oldbalanceOrg": oldbalanceOrg,
"newbalanceOrig":newbalanceOrig,
"oldbalanceDest":oldbalanceDest,
"newbalanceDest":newbalanceDest
}])
prediction =model.predict(input_data)[0]
st.subheader(f"Predition:' {int(prediction)}'")
if prediction==1:
st.error("This is Fraud")
else:
st.success("This is not Fraud")