diff --git a/mlapi.py b/mlapi.py index 644b730..5422f46 100755 --- a/mlapi.py +++ b/mlapi.py @@ -124,7 +124,7 @@ def post(self): g.logger.Debug (1, 'Monitor ID {} provided & matching config found in mlapi, ignoring objectconfig.ini'.format(mid)) config_copy = copy.copy(g.config) poly_copy = copy.copy(g.polygons) - g.polygons = g.monitor_polygons[mid] + g.polygons = copy.copy(g.monitor_polygons[mid]) for key in g.monitor_config[mid]: @@ -183,6 +183,10 @@ def post(self): else: stream_options = req.get('stream_options') if not stream_options: + if config_copy: + g.log.Debug(2, 'Restoring global config & ml_options') + g.config = config_copy + g.polygons = poly_copy abort(400, msg='No stream options found') stream_options['api'] = zmapi stream_options['polygons'] = g.polygons @@ -199,6 +203,10 @@ def post(self): g.log.Debug (1,'Object Recognition requested') #m = ObjectDetect.Object() else: + if config_copy: + g.log.Debug(2, 'Restoring global config & ml_options') + g.config = config_copy + g.polygons = poly_copy abort(400, msg='Invalid Model:{}'.format(args['type'])) if not stream: