1 回答

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超17個(gè)贊
您可以從函數(shù)返回這些變量。
您必須解壓縮從函數(shù)發(fā)送的變量upload。
首先,您必須將它們從 退回upload,然后將其拆包發(fā)送到render_template。
@app.route('/articles', methods=['GET', 'POST'])
def articles():
label, probability = upload()
return render_template('articles.html', label=label, probability=probability)
def upload():
if request.method == 'POST':
# Save the file to static/uploads
label = "some string from process above"
probability = "another string"
return (label, probability)
return (None, None)
添加回答
舉報(bào)