Created
March 17, 2018 17:48
-
-
Save SandyRogers/1fc930687174a9deb3650d515ea8c0f7 to your computer and use it in GitHub Desktop.
Basic Flask skeleton for SageMaker Docker file
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
from flask import Flask, request, abort | |
@app.route('/ping', methods=['GET', 'POST']) | |
def ping(): | |
return 'ping is pong' | |
@app.route('/invocations', methods=['POST']) | |
def invocation(): | |
data = request.get_json() | |
if not data: | |
abort(418, "Send some data plz") | |
norms = data.get('norms', []) | |
icons = .... (the prediction code) | |
return json.dumps({'icons': icons}) | |
if __name__ == '__main__': | |
app.run(debug=True, host='0.0.0.0', port=8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment