import gradio as gr import subprocess def run_pipeline(): try: result = subprocess.run( ["python", "src/train.py"], capture_output=True, text=True ) if result.returncode == 0: return "Pipeline executed successfully:\n\n" + result.stdout else: return "Pipeline failed:\n\n" + result.stderr except Exception as e: return str(e) demo = gr.Interface( fn=run_pipeline, inputs=[], outputs="text", title="Credit Card Fraud Detection with DuckDB", description="Click Generate to run the DuckDB Medallion pipeline and train the fraud model." ) demo.launch()