inoki-giskard commited on
Commit
bfb27a7
1 Parent(s): 2ecd2bd

Read status every 5 seconds

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -18,6 +18,15 @@ def read_logs():
18
  previous_url = ""
19
  ml_worker = None
20
 
 
 
 
 
 
 
 
 
 
21
  def run_ml_worker(url, api_key, hf_token):
22
  global ml_worker, previous_url
23
  previous_url = url
@@ -69,6 +78,7 @@ with gr.Blocks() as iface:
69
 
70
  logs = gr.Textbox(label="Giskard ML worker log:")
71
  iface.load(read_logs, None, logs, every=0.5)
 
72
 
73
  iface.queue()
74
  iface.launch()
 
18
  previous_url = ""
19
  ml_worker = None
20
 
21
+ def read_status():
22
+ if ml_worker:
23
+ return f"ML worker serving {previous_url}"
24
+ elif len(previous_url):
25
+ return f"ML worker exited for {previous_url}"
26
+ else:
27
+ return "ML worker not started"
28
+
29
+
30
  def run_ml_worker(url, api_key, hf_token):
31
  global ml_worker, previous_url
32
  previous_url = url
 
78
 
79
  logs = gr.Textbox(label="Giskard ML worker log:")
80
  iface.load(read_logs, None, logs, every=0.5)
81
+ iface.load(read_status, None, output, every=5)
82
 
83
  iface.queue()
84
  iface.launch()