From c9a140900dd82e5e68c49a299371e45511e2410b Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Thu, 6 Aug 2020 12:21:31 +0530 Subject: fixed tfWorking --- app/views.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/views.py b/app/views.py index 7c005c7..0f544b1 100644 --- a/app/views.py +++ b/app/views.py @@ -112,12 +112,13 @@ def wtform(): tfWorking = -1 -try: - import tensorflow as tf - tfWorking = 1 -except: - print("Could not load tensorflow model :/") - tfWorking = 0 +if tfWorking == -1: + try: + import tensorflow as tf + tfWorking = 1 + except: + print("Could not load tensorflow model :/") + tfWorking = 0 if tfWorking == 1: from lstm_chem.utils.config import process_config @@ -141,11 +142,11 @@ def generate(): if request.method == 'POST' and form.validate_on_submit(): - result = gen.sample(form.n.data) print(tfWorking) if tfWorking == 0: flash("Failed to initialise the model!","danger") else: + result = gen.sample(form.n.data) return render_template('generate.html',expName=j["exp_name"],epochs=j["num_epochs"],optimizer=j["optimizer"].capitalize(), form=form,result=result) return render_template('generate.html',expName=j["exp_name"],epochs=j["num_epochs"],optimizer=j["optimizer"].capitalize(), form=form) -- cgit v1.2.3