fixed tfWorking

This commit is contained in:
Navan Chauhan 2020-08-06 12:21:31 +05:30
parent a4619c59d9
commit c9a140900d
1 changed files with 8 additions and 7 deletions

View File

@ -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)