Updated decision making
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1f7f977e75
commit
5d83767d83
@ -63,10 +63,15 @@ def on_message_creator(mqtt_: MQTT):
|
|||||||
def on_message(channel, method_frame, header_frame, body):
|
def on_message(channel, method_frame, header_frame, body):
|
||||||
msg_json = json.loads(body)
|
msg_json = json.loads(body)
|
||||||
if 'probability' not in msg_json:
|
if 'probability' not in msg_json:
|
||||||
logging.error("Malformed message from broker")
|
logging.error("Malformed message from classifier")
|
||||||
return
|
return
|
||||||
|
|
||||||
if msg_json['probability'] > 0.5:
|
if 'class' not in msg_json:
|
||||||
|
logging.error("Malformed message from classifier")
|
||||||
|
return
|
||||||
|
|
||||||
|
# TODO: strurnus should not be hardcoded here
|
||||||
|
if (msg_json['class'] == 'sturnus') and (msg_json['probability'] > 0.51):
|
||||||
r = requests.get(f"http://{config.INPUT_HOSTNAME}/sample/{msg_json['tag']}")
|
r = requests.get(f"http://{config.INPUT_HOSTNAME}/sample/{msg_json['tag']}")
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
if 'device_id' not in r.json():
|
if 'device_id' not in r.json():
|
||||||
|
Loading…
Reference in New Issue
Block a user