Call Microservice API for Reuters Document Similarity Model

You must run doc_similarity_reuters.ipynb first

Call the recommend service to get similar documents to document 6003


In [1]:
import requests
import json
import pprint
params = {}
params["user_id"] = 1
params["recent_interactions"] = "6023"
params["limit"] = 4
params["client"] = "reuters"
r = requests.get("http://127.0.0.1:5000/recommend",params=params)
print r.status_code
j = json.loads(r.text)
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(j)


200
{   u'recommended': [   {   u'item': 17254, u'score': 0.5830801725387573},
                        {   u'item': 17289, u'score': 0.5830801725387573},
                        {   u'item': 17359, u'score': 0.5305154919624329},
                        {   u'item': 3430, u'score': 0.5303963124752045}]}

In [ ]: