@app.route ('/ article //') def article (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)