riyadahmadov
commited on
Commit
•
edbfd27
1
Parent(s):
b21965b
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,7 @@ def predict(transaction_id, customer_id, merchant_id, amount, transaction_time,
|
|
68 |
data.drop(columns=['customer_age', 'card_type_Discover', 'card_type_Visa', 'purchase_category_Groceries', 'purchase_category_Retail', 'purchase_category_Travel', 'Age_group_33-60', 'Age_group_60+'], inplace=True)
|
69 |
# Make predictions
|
70 |
prediction = clf.predict(data)
|
71 |
-
result = "
|
72 |
# Custom output for specific IDs
|
73 |
return f'Customer with ID {customer_id} and Transaction ID {transaction_id}, which happened at {transaction_time}, is {result}'
|
74 |
except Exception as e:
|
@@ -80,7 +80,7 @@ inputs = [
|
|
80 |
gr.Textbox(label="Customer ID"),
|
81 |
gr.Textbox(label="Merchant ID"),
|
82 |
gr.Number(label="Amount"),
|
83 |
-
gr.Textbox(label="Transaction
|
84 |
gr.Dropdown(choices=card_type_choices, label="Card Type"),
|
85 |
gr.Dropdown(choices=location_choices, label="Location"),
|
86 |
gr.Dropdown(choices=purchase_category_choices, label="Purchase Category"),
|
|
|
68 |
data.drop(columns=['customer_age', 'card_type_Discover', 'card_type_Visa', 'purchase_category_Groceries', 'purchase_category_Retail', 'purchase_category_Travel', 'Age_group_33-60', 'Age_group_60+'], inplace=True)
|
69 |
# Make predictions
|
70 |
prediction = clf.predict(data)
|
71 |
+
result = "Fraud ❌" if prediction[0] == 1 else "Not Fraud ✅"
|
72 |
# Custom output for specific IDs
|
73 |
return f'Customer with ID {customer_id} and Transaction ID {transaction_id}, which happened at {transaction_time}, is {result}'
|
74 |
except Exception as e:
|
|
|
80 |
gr.Textbox(label="Customer ID"),
|
81 |
gr.Textbox(label="Merchant ID"),
|
82 |
gr.Number(label="Amount"),
|
83 |
+
gr.Textbox(label="Transaction Date (YYYY-MM-DD)"),
|
84 |
gr.Dropdown(choices=card_type_choices, label="Card Type"),
|
85 |
gr.Dropdown(choices=location_choices, label="Location"),
|
86 |
gr.Dropdown(choices=purchase_category_choices, label="Purchase Category"),
|