Batch API support

This commit is contained in:
Madison May
2014-12-18 15:27:16 -05:00
parent cc1d6dc502
commit 9ed17b8f34
9 changed files with 27 additions and 47 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ import numpy as np
from indicoio.utils import image_preprocess, api_handler
def facial_features(api_root, image):
def facial_features(api_root, image, batch=False):
"""
Given an grayscale input image of a face, returns a 48 dimensional feature vector explaining that face.
Useful as a form of feature engineering for face oriented tasks.
@@ -27,9 +27,9 @@ def facial_features(api_root, image):
:type image: list of lists
:rtype: List containing feature responses
"""
return api_handler(image, api_root + "facialfeatures")
return api_handler(image, api_root + "facialfeatures", batch=batch)
def image_features(api_root, image):
def image_features(api_root, image, batch=False):
"""
Given an input image, returns a 2048 dimensional sparse feature vector explaining that image.
Useful as a form of feature engineering for image oriented tasks.
@@ -60,4 +60,4 @@ def image_features(api_root, image):
:rtype: List containing features
"""
image = image_preprocess(image)
return api_handler(image, api_root + "imagefeatures")
return api_handler(image, api_root + "imagefeatures", batch=batch)