Spaces:
Sleeping
Sleeping
Commit
•
6f0b68f
1
Parent(s):
b243576
App.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import streamlit as st
|
3 |
+
import pandas as pd
|
4 |
+
import numpy as np
|
5 |
+
import pickle
|
6 |
+
|
7 |
+
def main():
|
8 |
+
st.title('Fraud Detector')
|
9 |
+
|
10 |
+
file = st.file_uploader("Choose a file")
|
11 |
+
|
12 |
+
if file is not None:
|
13 |
+
classifier = pickle.load(open('RandomForrestClassifier_df4x.pkl', 'rb'))
|
14 |
+
|
15 |
+
df = pd.read_csv(file)
|
16 |
+
for col in ['Class']:
|
17 |
+
df = df.loc[:,df.columns != col]
|
18 |
+
df = pd.DataFrame(MinMaxScaler().fit(df).transform(df), columns=df.columns)
|
19 |
+
st.write("The dataset you uploaded is:")
|
20 |
+
st.write(df)
|
21 |
+
|
22 |
+
result_df = pd.DataFrame(classifier.predict_proba(df))
|
23 |
+
|
24 |
+
st.write("Output DataFrame depicting probability of the transaction being fraudulant.")
|
25 |
+
st.write(result_df)
|
26 |
+
|
27 |
+
main()
|