Skip to content

Instantly share code, notes, and snippets.

@SandyRogers
Created March 17, 2018 17:48
Show Gist options
  • Save SandyRogers/1fc930687174a9deb3650d515ea8c0f7 to your computer and use it in GitHub Desktop.
Save SandyRogers/1fc930687174a9deb3650d515ea8c0f7 to your computer and use it in GitHub Desktop.
Basic Flask skeleton for SageMaker Docker file
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