Running routes.py
@app.route('/articles', methods=['GET', 'POST'])
def articles():
upload()
return render_template('articles.html')
And this function that saves an image and processes its information
def upload():
if request.method == 'POST':
# Save the file to static/uploads
label = "some string from process above"
probability = "another string"
return None
return None
How do I make use of the variables label and probability in rendering the template? Some people use something close to:
return render_template('articles.html', label=label, probability=probability)
This would be done to make a reference to variables using js. But how do I make a reference to that variable if it is computed inside of upload()? Any need for global variables?
uploadand then unpack it to send it torender_template.