Exemplo n.º 1
0
 def __init__(self):
     self._bootstrapped = False
     self.logger = logging.getLogger('genetic_algorithm.tasks.TaskQueue')
     self.cfg = Config()
     self.connector = connector.get_connector()
     self.tasks = []
     self.generate_tasks()
Exemplo n.º 2
0
def train_models():
    models = ['random-forest']
    device = training_test.load_data('data/traindata.csv')
    with get_connector(app) as conn:
        data = {'device': device.to_json(orient="records"), 'models': models}
        response = conn.get(LOCAL_URL + 'retrain', json=data)
    return {"msg": response['msg']}, 201
Exemplo n.º 3
0
def handle_make_prediction_event(json):
    models = json['models']

    with get_connector(app) as conn:
        data = {'device': json['device'], 'models': models}
        response = conn.post(HEROKU_URL + 'predictions', json=data).json()
    print(response)
    socketio.emit(make_prediction_response, response)
Exemplo n.º 4
0
def handle_train_models_event(json):
    models = json['models']
    device = json['device']

    device['HasDetections'] = {
        'name': int(json['hasDetections'] == True),
        'description': "has detection"
    }
    with get_connector(app) as conn:
        data = {'device': device, 'models': models}
        response = conn.post(HEROKU_URL + 'retrain-one', json=data)
    print(response.text)
    socketio.emit(train_models_response, response.text)
Exemplo n.º 5
0
 def __init__(self):
     super().__init__()
     self.connector = connector.get_connector()
Exemplo n.º 6
0
 def __init__(self, sensor: Sensor):
     super().__init__()
     self.sensor = sensor
     self.connector = connector.get_connector()
Exemplo n.º 7
0
def handle_get_models_emit(json):
    with get_connector(app) as conn:
        models = conn.get(HEROKU_URL + 'get-models').json()
    socketio.emit(get_models_response, models)