Exemple #1
0
def predictions_to_json(raw_predictions, output):
    predictions = _get_jsonable_obj(raw_predictions, pandas_orient="records")
    wrapper_attr_name = os.environ.get(PREDICTIONS_WRAPPER_ATTR_NAME_ENV_KEY,
                                       None)
    if wrapper_attr_name:
        predictions = {wrapper_attr_name: predictions}
    json.dump(predictions, output, cls=NumpyEncoder)
Exemple #2
0
def predictions_to_json(raw_predictions, output):
    predictions = _get_jsonable_obj(raw_predictions, pandas_orient="records")
    json.dump(predictions, output, cls=NumpyEncoder)
Exemple #3
0
def predictions_to_json(raw_predictions, output):
    predictions = _get_jsonable_obj(raw_predictions, pandas_orient="records")
    if os.environ.get(FORCE_TF_SERVING_OUTPUT):
        predictions = {"predictions": predictions}
    json.dump(predictions, output, cls=NumpyEncoder)