2

I am trying to make a single prediction request using the google-cloud-automl gem in the google-cloud-ruby library:

Google::Cloud::AutoML.configure do |config|
  config.credentials = "/path/to/credentials.json"
end

client = Google::Cloud::AutoML.prediction_service

payload = {
  instances: [
    { text: "example text to be classified" }
  ]
}

client.predict(name: "model_name", payload: payload)

The model being called is a simple binary classifier to classify a string of text. The text attribute is the only feature for this model.

When calling .predict, I am getting the following error:

Unknown field name 'instances' in initialization map entry

Has anyone else run into this before? I can't seem to find any examples of what the payload hash should look like.

Neil
  • 95
  • 3
  • 9

0 Answers0