forked from SABARISH-M/AWS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
92 lines (37 loc) · 1.87 KB
/
app.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import numpy as np
import pickle
import streamlit as st
#loading the saved model
loaded_model = pickle.load(open('C:/Users/sabarishmanogaran/OneDrive - revature.com/Desktop/ML/finalized_model.sav', 'rb'))
#model1 = pickle.load(open('C:/Users/sabarishmanogaran/OneDrive - revature.com/Desktop/DS/Projectthree/model1.pkl','rb'))
#creating a function for predection
def procurement_preduiction(input_data):
input_data_as_numpy_as_array = np.asarray(input_data)
#resahpe the array as we are predicting for one instance
input_data_reshaped = input_data_as_numpy_as_array.reshape(1,-1)
Prediction = loaded_model.predict(input_data_reshaped)
print(Prediction)
if (Prediction[0] == 0):
return 'Procurement Fraud does not happen'
else:
return 'Procurement Fraud happens'
def main():
#giving a title
st.title('Procuremnt Fruad Web App')
#getting the input data from the user
UnitPrice = st.text_input('Number of Unit Price')
InflatedInvoice = st.text_input('InflatedInvoice')
Employeescolludingwithsupplierswithhighercost = st.text_input('Employees colluding with suppliers with higher cost')
print(type(UnitPrice))
print(type(InflatedInvoice))
print(type(Employeescolludingwithsupplierswithhighercost))
#code for Prediction
Fraudness = ''
#creating a button for Prediction
if st.button('Predict'):
Fraudness = procurement_preduiction([int(UnitPrice), int(InflatedInvoice), int(Employeescolludingwithsupplierswithhighercost)])
print('Format: ', Fraudness)
print('Type: ', type(Fraudness))
st.success(Fraudness)
if __name__ == '__main__':
main()