diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2020-08-06 12:21:31 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2020-08-06 12:21:31 +0530 |
commit | c9a140900dd82e5e68c49a299371e45511e2410b (patch) | |
tree | d8b234fd0006581e5ae15ae797bd4bae0a5c084a /app/views.py | |
parent | a4619c59d9d7f71dd6679b7e40ed86987d6e491a (diff) |
fixed tfWorking
Diffstat (limited to 'app/views.py')
-rw-r--r-- | app/views.py | 15 |
1 files changed, 8 insertions, 7 deletions
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) |