updated app.py to include clear logging
Browse files
app.py
CHANGED
@@ -3,14 +3,18 @@ import subprocess
|
|
3 |
|
4 |
def run_training():
|
5 |
try:
|
|
|
6 |
result = subprocess.run(["python", "train_abuse_model.py"], capture_output=True, text=True)
|
7 |
-
print("
|
8 |
-
print("
|
|
|
9 |
return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
|
10 |
except Exception as e:
|
|
|
11 |
return f"Exception occurred:\n{str(e)}"
|
12 |
|
13 |
|
|
|
14 |
# Define a simple Gradio interface with one button
|
15 |
demo = gr.Interface(
|
16 |
fn=run_training,
|
|
|
3 |
|
4 |
def run_training():
|
5 |
try:
|
6 |
+
print("β
Training started.")
|
7 |
result = subprocess.run(["python", "train_abuse_model.py"], capture_output=True, text=True)
|
8 |
+
print("β
Training finished.")
|
9 |
+
print("STDOUT:", result.stdout)
|
10 |
+
print("STDERR:", result.stderr)
|
11 |
return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
|
12 |
except Exception as e:
|
13 |
+
print("β Exception occurred:", e)
|
14 |
return f"Exception occurred:\n{str(e)}"
|
15 |
|
16 |
|
17 |
+
|
18 |
# Define a simple Gradio interface with one button
|
19 |
demo = gr.Interface(
|
20 |
fn=run_training,
|