Spaces:
Build error
Build error
Download app.py from FuurythumbsCPT/Fraud_detection_system_Test: direct link, hf CLI and curl.
- Browser
- Download file 648 Bytes
-
https://huggingface.co/spaces/FuurythumbsCPT/Fraud_detection_system_Test/resolve/main/app.py
- Command line
-
hf download hf://spaces/FuurythumbsCPT/Fraud_detection_system_Test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/FuurythumbsCPT/Fraud_detection_system_Test/resolve/main/app.py
648 Bytes
| import gradio as gr | |
| import pandas as pd | |
| import joblib | |
| # Load trained model | |
| model = joblib.load("fraud_model.pkl") | |
| def predict_fraud(file): | |
| df = pd.read_csv(file.name) | |
| predictions = model.predict(df.drop("Class", axis=1)) # Assuming "Class" is present | |
| df["Prediction"] = predictions | |
| return df[df["Prediction"] == 1] # Return only fraud | |
| interface = gr.Interface( | |
| fn=predict_fraud, | |
| inputs=gr.File(label="Upload CSV File"), | |
| outputs=gr.Dataframe(label="Fraudulent Transactions"), | |
| title="Fraud Detection System", | |
| description="Upload a bank statement (CSV) to detect fraudulent transactions." | |
| ) | |
| interface.launch() |