rshakked commited on
Commit
a3bf050
Β·
1 Parent(s): a9706bf

updated app.py to include clear logging

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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("STDOUT:\n", result.stdout)
8
- print("STDERR:\n", result.stderr)
 
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,