Imagine Client for Python
This library allows you to easily connect to doc.ai'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 |
API
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.
Example
from imagine_client_py import ImagineClient, ImageBasedModel
# Required parameters
API_KEY = <VALID_IMAGINE_API_KEY>
IMAGE_PATH = <IMAGE_FILE_PATH>
CLIENT_ID = <ANY_CLIENT_ID>
# 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)
##Tests
To run tests:
export IMAGINE_API_KEY=<API key> IMAGINE_CLIENT_ID=test
pytest
Metadata
Release files for imagine-client-py 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| imagine-client-py-0.3.0.tar.gz | 4.7 kB | Without provenance | Details for imagine-client-py-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| imagine_client_py-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for imagine_client_py-0.3.0-py3-none-any.whl |
Total release size: 11.9 kB
Release files / imagine-client-py-0.3.0.tar.gz
| Download URL | imagine-client-py-0.3.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9686cf2d214decc31f588023d49f41f70303e28655a416be1648006e0f58f7e
|
|
BLAKE2b-256 checksum How to use checksums |
335c11365d3bd3a2bc0ae6da026e866970f17329b5128aed13faf43426b1d56f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
|
Release files / imagine_client_py-0.3.0-py3-none-any.whl
| Download URL | imagine_client_py-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
168d0a86313b86a8974bd5dc0e4d4496922ae673cbb4038c428e49ee0ddefaa7
|
|
BLAKE2b-256 checksum How to use checksums |
6ac0e32ef8484db198a1f7d1044181fc14341daf88567de2eae38c5c71d8f9e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
|
Security for imagine-client-py 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.