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,10 +112,11 @@ def wtform():
tfWorking = -1 tfWorking = -1
try: if tfWorking == -1:
try:
import tensorflow as tf import tensorflow as tf
tfWorking = 1 tfWorking = 1
except: except:
print("Could not load tensorflow model :/") print("Could not load tensorflow model :/")
tfWorking = 0 tfWorking = 0
@ -141,11 +142,11 @@ def generate():
if request.method == 'POST' and form.validate_on_submit(): if request.method == 'POST' and form.validate_on_submit():
result = gen.sample(form.n.data)
print(tfWorking) print(tfWorking)
if tfWorking == 0: if tfWorking == 0:
flash("Failed to initialise the model!","danger") flash("Failed to initialise the model!","danger")
else: 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,result=result)
return render_template('generate.html',expName=j["exp_name"],epochs=j["num_epochs"],optimizer=j["optimizer"].capitalize(), form=form) return render_template('generate.html',expName=j["exp_name"],epochs=j["num_epochs"],optimizer=j["optimizer"].capitalize(), form=form)