Skip to main content

A python client for's Imagine API

Project description

Imagine Client for Python

This library allows you to easily connect to's Imagine API.

Supported Image Models

Model Id Type Description
phenomenal-face image Given a facial image, this model infers the age, sex, height, and weight of a person
happy-face image Given a facial image, this model infers the mood of a person
manna image Given a food image, this model infers whether the food is healthy/unhealthy
face-detector image Given an image, this model detects whether a face is present
food-detector image Given an image, this model detects whether food is present


ImageBasedModel.create(imagine_client, model_id)

Given an ImagineClient (imagine_client) and string (model_id), creates an image model. See the "Supported Image Models" section for a list of supported model ids.

ImageBasedModel.infer(image_file_stream, store=false, metadata=None)

Performs the model's inference on an image. A read stream should be passed as the parameter (image_file_stream).

ImageBasedModel.insert_correction(corrections_dict, metadata=None)

Uploads a correction label to the imagine API, for a given inference.

ImageBasedModel.insert_prediction(predictions_dict, metadata=None)

(FOR EDGE PREDICTIONS) Uploads a prediction label to the imagine API, for a given inference.


from imagine_client_py import ImagineClient, ImageBasedModel

# Required parameters

# Initialize imagine client
imagine_client = ImagineClient({
  'api_key': API_KEY,
  'client_id': CLIENT_ID

# Create the 'happy-face' model interface
model = ImageBasedModel.create(imagine_client, 'happy-face')

# Create a read stream to a image file
with open(IMAGE_PATH, 'rb') as image_face_file:
  # Perform the model's inference, on the image.
  result = model.infer(image_face_file)


To run tests:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for imagine-client-py, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size imagine_client_py-0.3.0-py3-none-any.whl (7.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size imagine-client-py-0.3.0.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page