Skip to content

Instantly share code, notes, and snippets.

@kedevked
Created April 28, 2019 18:08
Show Gist options
  • Save kedevked/aafe01e9c81b9c40b17b5cdeecac8dd3 to your computer and use it in GitHub Desktop.
Save kedevked/aafe01e9c81b9c40b17b5cdeecac8dd3 to your computer and use it in GitHub Desktop.
use the same graph during all flask requests
app = Flask(__name__)
graph = tf.get_default_graph()
@app.route('/predict', methods=['POST', 'GET'])
@cross_origin()
def predict_():
'''
returns a flower prediction
'''
global graph
with graph.as_default():
# process the request here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment