Exemple #1
0
async def __async_predict(data: Data):
    image_data = get_image_data(data.image_data)
    output_np = await active_predictor.async_predict(image_data)
    reshaped_output_nps = DataConverter.reshape_output(output_np)
    data.prediction = reshaped_output_nps.tolist()
    logger.info({'job_id': data.job_id, 'prediction': data.prediction})
def predict_image(image_data: Image.Image) -> List:
    output_np = active_predictor.predict(image_data)
    reshaped_output_nps = DataConverter.reshape_output(output_np)
    prediction = reshaped_output_nps.tolist()
    return prediction
def __predict(data: Data):
    input_np = DataConverter.convert_input_data_to_np(data.input_data)
    output_np = active_predictor.predict(input_np)
    reshaped_output_nps = DataConverter.reshape_output(output_np)
    data.prediction = reshaped_output_nps.tolist()
    logger.info({'job_id': data.job_id, 'prediction': data.prediction})
async def __async_predict(data: Data):
    input_np = DataConverter.convert_input_data_to_np(data.input_data)
    output_np = await active_predictor.async_predict(input_np)
    reshaped_output_nps = DataConverter.reshape_output(output_np)
    data.prediction = reshaped_output_nps.tolist()
    logger.info({"job_id": data.job_id, "prediction": data.prediction})