Analyze Image

analyze_image(data, {apis: List, [api_key]: String, [cloud]: String})
Make calls to many APIs in parallel.

Arguments

data – image or list of images – required – images to be analyzed
apis – list – required – the list of APIs to run in parallel
[api_key] – String – optional – your indico API key
[cloud] – String – optional – your private cloud subdomain

Output

A dictionary where each key maps to the specified models’ results. If used on a single input (not recommemnded as using multiple APIs quickly uses up your allotted calls!) you’ll get the default response, otherwise a list of the default.

# single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

# batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}

Example

require 'indico'
Indico.api_key =  'YOUR_API_KEY'

# single example
Indico.analyze_image("<IMAGE>", {apis:["image_features", "fer"]})

# batch example
Indico.analyze_image([
    "<IMAGE>", 
    "<IMAGE>"
], {apis:["image_features", "fer"]})