fixed up README and did some housecleaning

This commit is contained in:
Slater-Victoroff
2014-05-05 00:57:50 -04:00
parent 751133b335
commit 7f989f0097
5 changed files with 56 additions and 11 deletions
+1
View File
@@ -0,0 +1 @@
JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'}
+4 -3
View File
@@ -3,10 +3,11 @@ import json
import requests
import numpy as np
from IndicoIo import JSON_HEADERS
base_url = lambda c: "http://indico.io/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
response = requests.post(base_url("facial"), data=data_dict, headers=JSON_HEADERS)
return json.loads(response.content)
+3 -3
View File
@@ -2,11 +2,11 @@ import json
import requests
import numpy as np
from IndicoIo import JSON_HEADERS
base_url = "http://indico.io/api/fer/classify"
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
def fer(face):
data_dict = json.dumps({"image": face})
response = requests.post(base_url, data=data_dict, headers=headers)
return response.content
response = requests.post(base_url, data=data_dict, headers=JSON_HEADERS)
return json.loads(response.content)
+4 -4
View File
@@ -1,20 +1,20 @@
import requests
import json
from IndicoIo import JSON_HEADERS
base_url = lambda c: "http://indico.io/api/sentiment/%s/classify" % c
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
def political(test_text):
data_dict = json.dumps({'text': test_text})
response = requests.post(base_url("political"), data=data_dict, headers=headers)
response = requests.post(base_url("political"), data=data_dict, headers=JSON_HEADERS)
return json.loads(response.content)
def spam(test_text):
data_dict = json.dumps({'text': test_text})
response = requests.post(base_url("spam"), data=data_dict, headers=headers)
response = requests.post(base_url("spam"), data=data_dict, headers=JSON_HEADERS)
return json.loads(response.content)
def posneg(test_text):
data_dict = json.dumps({'text': test_text})
response = requests.post(base_url("sentiment"), data=data_dict, headers=headers)
response = requests.post(base_url("sentiment"), data=data_dict, headers=JSON_HEADERS)
return json.loads(response.content)