Python 如何从flask中的表中检索值
这是一个生成阿拉伯诗歌的HTML页面Python 如何从flask中的表中检索值,python,html,flask,nlp,text-classification,Python,Html,Flask,Nlp,Text Classification,这是一个生成阿拉伯诗歌的HTML页面 PS:我需要从表中检索诗歌和诗歌。诗歌是在browser\html页面中生成的?用户是否键入了这首诗?@Mike67不,它是从excel文件生成的。这不是一首输入诗 elif request.form['action'] == 'Classify': train = pd.read_excel('/home/sirina/Desktop/Project/Corpus2/Two-versed Poems/corpusTwoColumn
PS:我需要从表中检索诗歌和诗歌。诗歌是在browser\html页面中生成的?用户是否键入了这首诗?@Mike67不,它是从excel文件生成的。这不是一首输入诗
elif request.form['action'] == 'Classify':
train = pd.read_excel('/home/sirina/Desktop/Project/Corpus2/Two-versed Poems/corpusTwoColumnsTrain.xlsx')
Quasida = [' '.join([x,y]) for x,y in zip(train.Sader, train.Ajez)]
count_vect = CountVectorizer()
X_train_counts = count_vect.fit_transform(Quasida)
tfidf_transformer = TfidfTransformer()
X_train_tfidf = tfidf_transformer.fit_transform(X_train_counts)
clf = LinearSVC().fit(X_train_tfidf, train.Era)
#here i need the poem that i generated to predicted
predicted=clf.predict(count_vect.transform(poem))
return render_template('testt.html',poem=poem,prediction=predicted[0])
return render_template('testt.html')