Skip to content

Commit

Permalink
Merge pull request #1120 from anarkiwi/wf
Browse files Browse the repository at this point in the history
always init predictions before starting process.
  • Loading branch information
anarkiwi authored Jan 23, 2024
2 parents 862b64b + ab980ab commit a860895
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gamutrfwaterfall/gamutrfwaterfall/waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,11 +1064,18 @@ def sig_handler(_sig=None, _frame=None):

class FlaskHandler:
def __init__(
self, savefig_path, predictions, port, refresh, inference_server, inference_port
self,
savefig_path,
static_folder,
predictions,
port,
refresh,
inference_server,
inference_port,
):
self.inference_addr = f"tcp://{inference_server}:{inference_port}"
self.savefig_path = savefig_path
self.static_folder = os.path.dirname(savefig_path)
self.static_folder = static_folder
self.predictions_file = "predictions.html"
self.refresh = refresh
self.predictions = predictions
Expand All @@ -1085,6 +1092,7 @@ def __init__(
kwargs={"host": "0.0.0.0", "port": port}, # nosec
)
self.zmq_process = multiprocessing.Process(target=self.poll_zmq)
self.write_predictions_content("no predictions yet")

def start(self):
self.process.start()
Expand All @@ -1107,7 +1115,6 @@ def poll_zmq(self):
DELIM = "\n\n"
json_buffer = ""
item_buffer = []
self.write_predictions_content("no predictions yet")

while True:
try:
Expand Down Expand Up @@ -1199,6 +1206,7 @@ def main():
savefig_path = os.path.join(tempdir, "waterfall.png")
flask = FlaskHandler(
savefig_path,
tempdir,
args.predictions,
args.port,
args.refresh,
Expand Down

0 comments on commit a860895

Please sign in to comment.