Getting Started
Welcome to our API.
Convert images to feature vectors for use in downstream applications.
This API is still under development and will evolve.
What can the vectors be used for?
- Finding similar images
- Ranking for recommender systems
- Clustering images to different categories
- Classification and other machine learning tasks
Errors
Code | Name | Description |
---|---|---|
200 | OK | Success |
500 | Error | Malformed request or invalid base64 |
All errors will return JSON in the following format:
{
"statusCode": 500,
"message": "Internal server error"
}
Scaling
Need something faster and more scalable than our free tier?
Check out the paid tier
/image
Get a feature vector for any image
Parameters
- image
- The base64 encoded image
Response time varies in the free tier - normally 1-3 seconds.
from base64 import b64encode
import json
import requests
url = "https://sruhyjfrd6.execute-api.us-east-2.amazonaws.com/image"
with open("your_image_file.jpeg", "rb") as imageFile:
img_string = b64encode(imageFile.read()).decode('utf-8')
data = {"image": img_string}
r = requests.post(url, json=data)
if r.status_code == 200:
# Get latent vector
latent_vector = r.json()['body']['image_vector']
print(len(latent_vector))
else:
# Print error response
print(r.json())
{
"statusCode": 200,
"body": {
"image_vector": [
-0.01137700118124485,
-0.0895775631070137,
...]
}
}
{
"statusCode": 400
"image": null,
"error": "Invalid base64 string"
}