src.hersteller_services.ml_serving.ml_serving_service.py

MlServingService

class MlServingService(*args, **kwargs)

Bases: FastIoTService

ML Serving Service

Parameters:
  • args – Positional arguments passed to the superclass or internal use.

  • kwargs – Arbitrary keyword arguments, allowing for extensibility or forwarding to the superclass constructor or other components.

async get_prediction(_: str, msg: Thing) Thing

Gets a prediction using perform_prediction() and returns it to the requesting service

Parameters:
  • _ (str) – The topic of the message.

  • msg (Thing) – The data to be used for the prediction

Returns:

The prediction

Return type:

Thing

async perform_prediction(data: list[dict]) list[dict]

Performs a prediction using the model set in the ModelURI

Parameters:

data (list[dict]) – The data used for the prediction

Returns:

The predictions

Return type:

list[dict]