Created
April 28, 2019 18:08
-
-
Save kedevked/aafe01e9c81b9c40b17b5cdeecac8dd3 to your computer and use it in GitHub Desktop.
use the same graph during all flask requests
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
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