How to Identify Age from an Image in Ruby

Looking for an easy way to detect age from an image without going through the long and laborious process of training an AI with Deep Learning? If so, you’re in the right place; in this quick tutorial, we will demonstrate how you can use an API in Ruby to instantly detect the age of human faces from an image, along with their position and size.

To begin, we will add the Ruby client to the Gemfile:

gem 'cloudmersive-image-recognition-api-client', '~> 2.0.4'

Next, we can call the function with the following code:

# load the gem
require 'cloudmersive-image-recognition-api-client'
# setup authorization
CloudmersiveImageRecognitionApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'

This helpful tool will analyze all human faces in the image, regardless of whether they are facing the camera, ensuring you receive a complete representation of the data.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.