Code Optimization

Interesting things about software development and code optimization

Tensorflow, Flask and Multi-Threading

Hello friends,

very quick question and answer - are you trying to use your Tensorflow (Keras) prediction model from Flask? 

Here is your answer :) (You have to use Tensorflow sessions for graphs)


#on Flask run method

session_conf = tensorflow.ConfigProto(intra_op_parallelism_threads=1,

tensorflow.Session(graph=tensorflow.get_default_graph(), config=session_conf)
_graph = tensorflow.get_default_graph()

#on Flask run method


Thank you!