JAYASREESS commited on
Commit
aabb9c5
·
verified ·
1 Parent(s): 88b524e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -1,13 +1,26 @@
1
  import gradio as gr
 
2
 
3
- def status():
4
- return "DuckDB Fraud Detection Pipeline is ready. Run src/train.py to train the model."
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  demo = gr.Interface(
7
- fn=status,
8
  inputs=[],
9
  outputs="text",
10
  title="Credit Card Fraud Detection with DuckDB",
 
11
  )
12
 
13
  demo.launch()
 
1
  import gradio as gr
2
+ import subprocess
3
 
4
+ def run_pipeline():
5
+ try:
6
+ result = subprocess.run(
7
+ ["python", "src/train.py"],
8
+ capture_output=True,
9
+ text=True
10
+ )
11
+ if result.returncode == 0:
12
+ return "Pipeline executed successfully:\n\n" + result.stdout
13
+ else:
14
+ return "Pipeline failed:\n\n" + result.stderr
15
+ except Exception as e:
16
+ return str(e)
17
 
18
  demo = gr.Interface(
19
+ fn=run_pipeline,
20
  inputs=[],
21
  outputs="text",
22
  title="Credit Card Fraud Detection with DuckDB",
23
+ description="Click Generate to run the DuckDB Medallion pipeline and train the fraud model."
24
  )
25
 
26
  demo.launch()