Search in sources :

Example 1 with PredictorState

use of io.seldon.engine.predictors.PredictorState in project seldon-core by SeldonIO.

the class PredictionService method sendFeedback.

public void sendFeedback(Feedback feedback) throws InterruptedException, ExecutionException, InvalidProtocolBufferException {
    PredictorState predictorState = predictorBean.predictorStateFromPredictorSpec(enginePredictor.getPredictorSpec());
    predictorBean.sendFeedback(feedback, predictorState);
    return;
}
Also used : PredictorState(io.seldon.engine.predictors.PredictorState)

Example 2 with PredictorState

use of io.seldon.engine.predictors.PredictorState in project seldon-core by SeldonIO.

the class PredictionService method predict.

public SeldonMessage predict(SeldonMessage request) throws InterruptedException, ExecutionException, InvalidProtocolBufferException {
    if (!request.hasMeta()) {
        request = request.toBuilder().setMeta(Meta.newBuilder().setPuid(puidGenerator.nextPuidId()).build()).build();
    } else if (StringUtils.isEmpty(request.getMeta().getPuid())) {
        request = request.toBuilder().setMeta(request.getMeta().toBuilder().setPuid(puidGenerator.nextPuidId()).build()).build();
    }
    String puid = request.getMeta().getPuid();
    PredictorState predictorState = predictorBean.predictorStateFromPredictorSpec(enginePredictor.getPredictorSpec());
    SeldonMessage predictorReturn = predictorBean.predict(request, predictorState);
    SeldonMessage.Builder builder = SeldonMessage.newBuilder(predictorReturn).setMeta(Meta.newBuilder(predictorReturn.getMeta()).setPuid(puid));
    return builder.build();
}
Also used : PredictorState(io.seldon.engine.predictors.PredictorState) SeldonMessage(io.seldon.protos.PredictionProtos.SeldonMessage)

Aggregations

PredictorState (io.seldon.engine.predictors.PredictorState)2 SeldonMessage (io.seldon.protos.PredictionProtos.SeldonMessage)1