How to get prediction labels with Tensorflow Serving Predict API?

Hello! I have a keras classification model saved remotely, and I use RESTful API to call the model from my site and make predictions. The JSON request is done as follows

URL:

POST https://my.site/models/v1:predict

JSON:

{"instances": [["...something useful to predict a label..."]]}

and what I obtain is of the form (one value for each label)

{
  "predictions": [
    [
      0.001
      0.832
      ...
      0.104
    ]
  ]
}

However, I would like to also get the label corresponding to each prediction probability, is it possible? That is, I’d like to get something in the form

{
  "predictions": [
    [
      "label_1": 0.001
      "label_2": 0.832
      ...
      "label_n": 0.104
    ]
  ]
}

or

{
  "predictions": [
    [
      0.001
      0.832
      ...
      0.104
    ]
    [
      "label_1"
      "label_2"
      ...
      "label_n"
    ]
  ]
}

I read the official documentation about specifying signatures when exporting a model, which seems to be related to my question, but it is not very clear about what has to be done. Basically it consists of adding the argument signatures when saving the model:

@tf.function()
def my_predict(my_prediction_inputs):
    ...

my_signatures = my_predict.get_concrete_function(...)

tf.keras.models.save_model(model, path, signatures=my_signatures, ...)

Any hint/help would be appreciated, many thanks.

@sound_wave, Welcome to Tensorflow Forum!

Specifying signatures when exporting model instructs the tools like tensorflow serving or saved_model_cli to determine which ConcreteFunctions to use. I am not sure if this can help add labels to model outputs. Other option to achieve the same would be to customise the model output layer to return class labels with predictions.
This article shows an example to customize the model output layer to output both class labels and predictions. Let us know if this helps your use-case. Thank you!