<commit_before>import numpy as np
import cv2

# Load an image
#img = cv2.imread('picture.jpg')
#print img

with open('picture.jpg', 'rb') as f:
    data = f.read()
#print data
img=data
#with open('picture_out.jpg', 'wb') as f:
#    f.write(data)



ret = []



import httplib, urllib, base64  

#URL = 'http://grandmahenke.com/grandma/wp-content/uploads/2007/08/happy-anna.jpg'

# Image to analyse (body of the request)

#body = {'url': URL}
body = img

# API request for Emotion Detection

headers = {
   #'Content-type': 'application/json',
   'Content-type': 'application/octet-stream',
}

params = urllib.urlencode({
    # Request headers
    'Content-Type': 'application/json',
    'subscription-key': '<KEY>',
})

try:
   conn = httplib.HTTPSConnection('api.projectoxford.ai')
   conn.request("POST", "/emotion/v1.0/recognize?%s" % params, str(body) , headers)
   response = conn.getresponse()
   #print("Send request")

   data = response.read()
   ret = data
   conn.close()
except:
     print "Unexpected error:", sys.exc_info()[0]
     raise


import urllib2, time, json
from flask import Flask, render_template, request, jsonify
from ast import literal_eval

def printData( data ):
    r = json.loads(data)
    print r[0]["scores"]

printData(ret)
<commit_msg>highest value found in spotify<commit_after>import numpy as np
import cv2

# Load an image
#img = cv2.imread('picture.jpg')
#print img

with open('picture.jpg', 'rb') as f:
    data = f.read()
#print data
img=data
#with open('picture_out.jpg', 'wb') as f:
#    f.write(data)



ret = []



import httplib, urllib, base64  

#URL = 'http://grandmahenke.com/grandma/wp-content/uploads/2007/08/happy-anna.jpg'

# Image to analyse (body of the request)

#body = {'url': URL}
body = img

# API request for Emotion Detection

headers = {
   #'Content-type': 'application/json',
   'Content-type': 'application/octet-stream',
}

params = urllib.urlencode({
    # Request headers
    'Content-Type': 'application/json',
    'subscription-key': '<KEY>',
})

try:
   conn = httplib.HTTPSConnection('api.projectoxford.ai')
   conn.request("POST", "/emotion/v1.0/recognize?%s" % params, str(body) , headers)
   response = conn.getresponse()
   #print("Send request")

   data = response.read()
   ret = data
   conn.close()
except:
     print "Unexpected error:", sys.exc_info()[0]
     raise


import urllib2, time, json
from flask import Flask, render_template, request, jsonify
from ast import literal_eval

def printData( data ):
    r = json.loads(data)
    l = r[0]["scores"]
    return max(l, key=lambda i: l[i])

print printData(ret)

{'fraction_non_alphanumeric': 0.15378700499807765, 'fraction_numerical': 0.011534025374855825, 'mean_word_length': 3.800738007380074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5953887', 'n_tokens_mistral': 946, 'n_tokens_neox': 911, 'n_words': 234}