aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/views.py15
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)