From 156c8727e55d45779e8d0f6a38c39be2d8ad5691 Mon Sep 17 00:00:00 2001 From: Slater-Victoroff Date: Sun, 4 May 2014 22:25:39 -0400 Subject: [PATCH] facial features api working --- IndicoIo/images/facial_features.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/IndicoIo/images/facial_features.py b/IndicoIo/images/facial_features.py index e69de29..0ac9775 100644 --- a/IndicoIo/images/facial_features.py +++ b/IndicoIo/images/facial_features.py @@ -0,0 +1,17 @@ +import json + +import requests +import numpy as np + +TEST_GOOD_FACE = np.linspace(0,50,48*48).reshape(48,48).tolist() +TEST_BAD_FACE = np.linspace(0,50,56*56).reshape(56,56).tolist() + +base_url = lambda c: "http://localhost/api/features/%s" % c +headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} + +def facial(face): + data_dict = json.dumps({"datums": face}) + response = requests.post(base_url("facial"), data=data_dict, headers=headers) + return response.content + +print facial(TEST_BAD_FACE)