Monitor Model Predictions

Pre-requisite

In order to monitor your models in production, you need to create a deployment

import requests

deployment_id = os.environ["PICSELLIA_DEPLOYMENT_ID"]
url = f"https://example.com/api/v1/deployment/{deployment_id}/add"

encoded_image = base64.b64encode(image).decode('utf-8')

payload = {
    "platform_host": "localhost",
    "raw_predictions": {
        "labels": [0, 2],
        "boxes": [[0, 5, 100, 150], [0, 2, 20, 60]],
        "detection_scores": [0.5, 0.7]
    },
    "tags": {"condition": "sunny"},
    "latency": 0.1,
    "picture_id": "uuid4",
    "filename": "picture1.png",
    "height": 800,
    "width": 900,
    "source": "aws_ec2_eu_west_3",
    "model_type": "detection",
    "model": "detection-efficientnet-1",
    "image": encoded_image
}

headers = {
    "Accept": "application/json",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

Did this page help you?