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()