cmasukume commited on
Commit
1064dba
·
verified ·
1 Parent(s): 75570c3

Update slapp.py

Browse files
Files changed (1) hide show
  1. slapp.py +47 -60
slapp.py CHANGED
@@ -18,37 +18,47 @@ model = load_model()
18
  st.title("Fraud Detection API")
19
  st.markdown("Welcome to the Fraud Detection API! Please enter the transaction details below:")
20
 
21
- # Input fields for the transaction features
22
- time = st.number_input("Time", min_value=0.0, step=0.1)
23
- v1 = st.number_input("V1", step=0.01)
24
- v2 = st.number_input("V2", step=0.01)
25
- v3 = st.number_input("V3", step=0.01)
26
- v4 = st.number_input("V4", step=0.01)
27
- v5 = st.number_input("V5", step=0.01)
28
- v6 = st.number_input("V6", step=0.01)
29
- v7 = st.number_input("V7", step=0.01)
30
- v8 = st.number_input("V8", step=0.01)
31
- v9 = st.number_input("V9", step=0.01)
32
- v10 = st.number_input("V10", step=0.01)
33
- v11 = st.number_input("V11", step=0.01)
34
- v12 = st.number_input("V12", step=0.01)
35
- v13 = st.number_input("V13", step=0.01)
36
- v14 = st.number_input("V14", step=0.01)
37
- v15 = st.number_input("V15", step=0.01)
38
- v16 = st.number_input("V16", step=0.01)
39
- v17 = st.number_input("V17", step=0.01)
40
- v18 = st.number_input("V18", step=0.01)
41
- v19 = st.number_input("V19", step=0.01)
42
- v20 = st.number_input("V20", step=0.01)
43
- v21 = st.number_input("V21", step=0.01)
44
- v22 = st.number_input("V22", step=0.01)
45
- v23 = st.number_input("V23", step=0.01)
46
- v24 = st.number_input("V24", step=0.01)
47
- v25 = st.number_input("V25", step=0.01)
48
- v26 = st.number_input("V26", step=0.01)
49
- v27 = st.number_input("V27", step=0.01)
50
- v28 = st.number_input("V28", step=0.01)
51
- amount = st.number_input("Amount", min_value=0.0, step=0.1)
 
 
 
 
 
 
 
 
 
 
52
 
53
  # Button to make predictions
54
  if st.button("Predict"):
@@ -56,35 +66,11 @@ if st.button("Predict"):
56
  # Create a DataFrame from the input data
57
  transaction_data = pd.DataFrame({
58
  'Time': [time],
59
- 'V1': [v1],
60
- 'V2': [v2],
61
- 'V3': [v3],
62
- 'V4': [v4],
63
- 'V5': [v5],
64
- 'V6': [v6],
65
- 'V7': [v7],
66
- 'V8': [v8],
67
- 'V9': [v9],
68
- 'V10': [v10],
69
- 'V11': [v11],
70
- 'V12': [v12],
71
- 'V13': [v13],
72
- 'V14': [v14],
73
- 'V15': [v15],
74
- 'V16': [v16],
75
- 'V17': [v17],
76
- 'V18': [v18],
77
- 'V19': [v19],
78
- 'V20': [v20],
79
- 'V21': [v21],
80
- 'V22': [v22],
81
- 'V23': [v23],
82
- 'V24': [v24],
83
- 'V25': [v25],
84
- 'V26': [v26],
85
- 'V27': [v27],
86
- 'V28': [v28],
87
- 'Amount': [amount]
88
  })
89
 
90
  # Perform prediction
@@ -99,3 +85,4 @@ if st.button("Predict"):
99
  st.error("Model not loaded.")
100
 
101
 
 
 
18
  st.title("Fraud Detection API")
19
  st.markdown("Welcome to the Fraud Detection API! Please enter the transaction details below:")
20
 
21
+ # Tabs for input sections
22
+ tab1, tab2, tab3 = st.tabs(["Basic Info", "Features (V1 - V14)", "Features (V15 - V28)"])
23
+
24
+ with tab1:
25
+ st.header("Basic Information")
26
+ time = st.number_input("Time", min_value=0.0, step=0.1)
27
+ amount = st.number_input("Amount", min_value=0.0, step=0.1)
28
+
29
+ with tab2:
30
+ st.header("Features (V1 - V14)")
31
+ v1 = st.number_input("V1", step=0.01)
32
+ v2 = st.number_input("V2", step=0.01)
33
+ v3 = st.number_input("V3", step=0.01)
34
+ v4 = st.number_input("V4", step=0.01)
35
+ v5 = st.number_input("V5", step=0.01)
36
+ v6 = st.number_input("V6", step=0.01)
37
+ v7 = st.number_input("V7", step=0.01)
38
+ v8 = st.number_input("V8", step=0.01)
39
+ v9 = st.number_input("V9", step=0.01)
40
+ v10 = st.number_input("V10", step=0.01)
41
+ v11 = st.number_input("V11", step=0.01)
42
+ v12 = st.number_input("V12", step=0.01)
43
+ v13 = st.number_input("V13", step=0.01)
44
+ v14 = st.number_input("V14", step=0.01)
45
+
46
+ with tab3:
47
+ st.header("Features (V15 - V28)")
48
+ v15 = st.number_input("V15", step=0.01)
49
+ v16 = st.number_input("V16", step=0.01)
50
+ v17 = st.number_input("V17", step=0.01)
51
+ v18 = st.number_input("V18", step=0.01)
52
+ v19 = st.number_input("V19", step=0.01)
53
+ v20 = st.number_input("V20", step=0.01)
54
+ v21 = st.number_input("V21", step=0.01)
55
+ v22 = st.number_input("V22", step=0.01)
56
+ v23 = st.number_input("V23", step=0.01)
57
+ v24 = st.number_input("V24", step=0.01)
58
+ v25 = st.number_input("V25", step=0.01)
59
+ v26 = st.number_input("V26", step=0.01)
60
+ v27 = st.number_input("V27", step=0.01)
61
+ v28 = st.number_input("V28", step=0.01)
62
 
63
  # Button to make predictions
64
  if st.button("Predict"):
 
66
  # Create a DataFrame from the input data
67
  transaction_data = pd.DataFrame({
68
  'Time': [time],
69
+ 'V1': [v1], 'V2': [v2], 'V3': [v3], 'V4': [v4], 'V5': [v5], 'V6': [v6],
70
+ 'V7': [v7], 'V8': [v8], 'V9': [v9], 'V10': [v10], 'V11': [v11], 'V12': [v12],
71
+ 'V13': [v13], 'V14': [v14], 'V15': [v15], 'V16': [v16], 'V17': [v17], 'V18': [v18],
72
+ 'V19': [v19], 'V20': [v20], 'V21': [v21], 'V22': [v22], 'V23': [v23], 'V24': [v24],
73
+ 'V25': [v25], 'V26': [v26], 'V27': [v27], 'V28': [v28], 'Amount': [amount]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  })
75
 
76
  # Perform prediction
 
85
  st.error("Model not loaded.")
86
 
87
 
88
+