Spaces:
Build error
Build error
File size: 648 Bytes
ec8dc2d e42d338 d5b74cd e42d338 d5b74cd e42d338 ec8dc2d d5b74cd ec8dc2d e42d338 d5b74cd ec8dc2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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() |