inoki-giskard commited on
Commit
629a811
1 Parent(s): e05b343

Set ML worker to None after exiting

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -44,6 +44,7 @@ def run_ml_worker(url, api_key, hf_token):
44
  )
45
  args = ml_worker.args
46
  print(f"Process {args} exited with {ml_worker.wait()}")
 
47
 
48
 
49
  def stop_ml_worker():
@@ -51,6 +52,7 @@ def stop_ml_worker():
51
  if ml_worker is not None:
52
  print(f"Stopping ML worker for {previous_url}")
53
  ml_worker.terminate()
 
54
  print("ML worker stopped")
55
  return "ML worker stopped"
56
  return "ML worker not started"
 
44
  )
45
  args = ml_worker.args
46
  print(f"Process {args} exited with {ml_worker.wait()}")
47
+ ml_worker = None
48
 
49
 
50
  def stop_ml_worker():
 
52
  if ml_worker is not None:
53
  print(f"Stopping ML worker for {previous_url}")
54
  ml_worker.terminate()
55
+ ml_worker = None
56
  print("ML worker stopped")
57
  return "ML worker stopped"
58
  return "ML worker not started"