Spaces:
Sleeping
Sleeping
Create test.py
Browse files
test.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
import joblib
|
| 3 |
+
from config import TFIDF_VECTORIZER_PATH, MODEL_PATH
|
| 4 |
+
|
| 5 |
+
# Sample Input Text
|
| 6 |
+
test_text = """
|
| 7 |
+
Transaction ID: T123456789
|
| 8 |
+
Origin: India
|
| 9 |
+
Designation: Manager
|
| 10 |
+
Keywords: sanction, fraud, transaction
|
| 11 |
+
Name: John Doe
|
| 12 |
+
SWIFT Tag: XYZ123
|
| 13 |
+
Currency: USD
|
| 14 |
+
Entity: ACME Corp
|
| 15 |
+
Message: Urgent transaction request
|
| 16 |
+
City: Mumbai
|
| 17 |
+
Country: India
|
| 18 |
+
State: Maharashtra
|
| 19 |
+
Hit Type: Sanctions
|
| 20 |
+
Record Matching String: match-123
|
| 21 |
+
WatchList Match String: sanction-456
|
| 22 |
+
Payment Sender: Sender ABC
|
| 23 |
+
Payment Receiver: Receiver XYZ
|
| 24 |
+
Swift Message Type: MT103
|
| 25 |
+
Text Sanction Data: suspected sanctions
|
| 26 |
+
Matched Sanctioned Entity: Entity123
|
| 27 |
+
Red Flag Reason: Unusual transfer
|
| 28 |
+
Risk Level: High
|
| 29 |
+
Risk Score: 85.5
|
| 30 |
+
CDD Level: Enhanced
|
| 31 |
+
PEP Status: Yes
|
| 32 |
+
Sanction Description: SDN List
|
| 33 |
+
Checker Notes: Needs further review
|
| 34 |
+
Sanction Context: Context of sanction
|
| 35 |
+
Maker Action: Escalated
|
| 36 |
+
Customer Type: Individual
|
| 37 |
+
Industry: Finance
|
| 38 |
+
Transaction Type: Wire
|
| 39 |
+
Transaction Channel: Online
|
| 40 |
+
Geographic Origin: India
|
| 41 |
+
Geographic Destination: Russia
|
| 42 |
+
Risk Category: Category A
|
| 43 |
+
Risk Drivers: Risky geography
|
| 44 |
+
Alert Status: Open
|
| 45 |
+
Investigation Outcome: Pending
|
| 46 |
+
Source of Funds: Unknown
|
| 47 |
+
Purpose of Transaction: Payment
|
| 48 |
+
Beneficial Owner: Jane Roe
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
# Load models
|
| 52 |
+
vectorizer = joblib.load(TFIDF_VECTORIZER_PATH)
|
| 53 |
+
model = joblib.load(MODEL_PATH)
|
| 54 |
+
|
| 55 |
+
# Predict
|
| 56 |
+
test_vec = vectorizer.transform([test_text])
|
| 57 |
+
prediction = model.predict(test_vec)
|
| 58 |
+
|
| 59 |
+
print("Predicted Labels:", prediction[0])
|