Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Asarangi authored Apr 27, 2019
1 parent a7e8461 commit 045577b
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions MLDeploy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,50 @@
"print(primary)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n"
]
},
{
"ename": "WebserviceException",
"evalue": "Received bad response from service:\nResponse Code: 504\nHeaders: {'X-Ms-Request-Id': 'd0d67968-abd6-4716-b6d2-4160576b667e', 'Date': 'Sat, 27 Apr 2019 19:24:05 GMT', 'Content-Length': '109', 'Content-Type': 'text/plain; charset=utf-8'}\nContent: b'Post http://localhost:5001/score: net/http: request canceled (Client.Timeout exceeded while awaiting headers)'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mWebserviceException\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-23-b0c54a908403>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mtest_image\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdumps\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest_data\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtest_image\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mservice\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_data\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtest_image\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/azureml/core/webservice/aci.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, input_data)\u001b[0m\n\u001b[1;32m 210\u001b[0m \u001b[0;34m'Response Code: {}\\n'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 211\u001b[0m \u001b[0;34m'Headers: {}\\n'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 212\u001b[0;31m 'Content: {}'.format(resp.status_code, resp.headers, resp.content))\n\u001b[0m\u001b[1;32m 213\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m def update(self, image=None, tags=None, properties=None, description=None, auth_enabled=None, ssl_enabled=None,\n",
"\u001b[0;31mWebserviceException\u001b[0m: Received bad response from service:\nResponse Code: 504\nHeaders: {'X-Ms-Request-Id': 'd0d67968-abd6-4716-b6d2-4160576b667e', 'Date': 'Sat, 27 Apr 2019 19:24:05 GMT', 'Content-Length': '109', 'Content-Type': 'text/plain; charset=utf-8'}\nContent: b'Post http://localhost:5001/score: net/http: request canceled (Client.Timeout exceeded while awaiting headers)'"
]
}
],
"source": [
"# TEST DEPLOYMENT #\n",
"from PIL import Image\n",
"import requests\n",
"from io import BytesIO\n",
"import json\n",
"import base64\n",
"\n",
"response = requests.get('https://ie.trafficland.com/v1.0/15817/huge?system=weatherbug-mobile&pubtoken=ff2188f03769a07a9355314d41463aba6e45485412deaf26b6af8ad79360cf62&refreshRate=2000&rnd=1556391868445')\n",
"img = Image.open(BytesIO(response.content))\n",
"img = img.tobytes()\n",
"test_data = {}\n",
"test_data['img'] = base64.encodebytes(img).decode(\"utf-8\")\n",
"test_image = json.dumps(test_data)\n",
"print(type(test_image))\n",
"result = service.run(input_data = test_image)\n",
"print(result)"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 045577b

Please sign in to comment.