Created
August 24, 2016 18:30
-
-
Save crawles/d6dae819d371a1db0d798e7f7a3ed1f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2016-08-24T11:16:17.753340", | |
"start_time": "2016-08-24T11:16:17.733692" | |
}, | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"import json\n", | |
"\n", | |
"import dill\n", | |
"import pandas as pd\n", | |
"import sklearn\n", | |
"import requests" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2016-08-24T14:20:40.129088", | |
"start_time": "2016-08-24T14:20:40.044663" | |
}, | |
"collapsed": true | |
}, | |
"outputs": [], | |
"source": [ | |
"resp = requests.get(\"https://github.com/crawles/sentiment_analysis_twitter_model/raw/master/twitter_sentiment_model.pkl\")\n", | |
"resp.raise_for_status()\n", | |
"cl = dill.loads(resp.content)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"ExecuteTime": { | |
"end_time": "2016-08-22T17:52:15.653020", | |
"start_time": "2016-08-22T17:52:15.636712" | |
}, | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"# POST /polarity_compute\n", | |
"req = json.loads(REQUEST)\n", | |
"print(cl.predict_proba(req['body']['data'])[:][:,1])" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.5.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works on CF