Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,26 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
demo = gr.Interface(
|
| 7 |
-
fn=
|
| 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()
|