1
votes

I have been trying to use the Rekognition API to detect text in an image.

I have enabled full access for the Rekognition API (IAM), and am configuring the credentials and region in config of my app.

Here is my code:

client = Aws::Rekognition::Client.new
resp = client.detect_text({
  image: {
    s3_object: {
      bucket: bucket_name,
      name: "uploads/path/#{image_files.first}",
    },
  },
})

I have tested the API out with other methods such as 'detect_labels' and this returns data as expected, so the issue is not to do with the API not being enabled.

My error is 'undefined method `detect_text' for Aws::Rekognition::Client>', which suggests the request isn't even getting to the body.

The gem I am using is 'aws-sdk-rekognition', '~> 1.0.0.rc2', which as mentioned works for detect_labels but not detect_text.

I am not sure what the issue might be, here are the docs for the method https://docs.aws.amazon.com/sdkforruby/api/Aws/Rekognition/Client.html#detect_text-instance_method.

1

1 Answers

1
votes

The 1.0.0.rc2 version of the aws-sdk-rekognition gem dates to December 10, 2016.

The latest version is v1.22, as of March 21, 2019.