Add local api support, fix test case

This commit is contained in:
Madison May
2014-09-25 17:05:16 -04:00
parent 6898e1ea07
commit a3d4d85412
8 changed files with 46 additions and 15 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ import requests
import numpy as np
from indicoio import JSON_HEADERS
def fer(image):
def fer(api_root, image):
"""
Given a grayscale input image of a face, returns a probability distribution over emotional state.
Input should be in a list of list format, resizing will be attempted internally but for best
@@ -29,7 +29,7 @@ def fer(image):
"""
data_dict = json.dumps({"face": image})
response = requests.post("http://api.indico.io/fer", data=data_dict, headers=JSON_HEADERS)
response = requests.post(api_root + "fer", data=data_dict, headers=JSON_HEADERS)
response_dict = response.json()
if len(response_dict) < 2:
raise ValueError(response_dict.values()[0])