Reputation: 621
I would like to train my deep learning models with flask. I can already train them through the commandline but I figured it would be nice to train them with a good UI.
I managed to create such a trainer however, I do have a bit of a problem with it.
@app.route('/train', methods=['POST'])
def train():
architecture = get('architecture', str)
network = get_architecture(architecture)
network.train(...) # slow down happens here
return render_template("begin_training.html")
I would like to render the page first to display the parameters given by the user before beginning the training but I don't know how to do it. If I keep it this way, I would have to wait for the training to finish first before the page is rendered. Is it possible to render the page first before executing the training? Or how do I execute training as a background task?
Upvotes: 0
Views: 401
Reputation: 3022
Slow tasks should be executed in background. There are several ways to do that. One of them is using celery
, which is also documented in Flask document: http://flask.pocoo.org/docs/0.12/patterns/celery/
Upvotes: 1