@app.route('/article//'(def文章(id(:#创建光标mycursor=mydb.cursor(dictionary=True(
# Get article
result = mycursor.execute("SELECT label FROM articles WHERE id = %s", [id])
article = mycursor.fetchone()
features = prepData(article)
prediction = int((np.asscalar(load_model.predict(features)))*100)
return render_template('article.html', article=article, prediction=prediction)
{%extends‘layout.html‘%}
{%块体%}
<h1>{{article.title}}</h1>
<small>Written by {{article.author}} on {{article.create_date}}</small>
<hr>
<div>
{{article.body }}
</div>
<h1>Predicted:</h1>
{{ prediction }}
{%endblock%}