I want to input data (text area) from the html file and process it in Python, i made a form like so:
<form action="/" method="post">
<div class="postText">
<textarea name="" id="text" cols="30" rows="15" placeholder="Insert the post here">
</textarea>
</div>
<button type="submit">Go!</button>
</form>
In Flask I have the following route:
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
sequences = ['This is a gaming sentence']
prediction = clf.predict(sequences)[0].title()
return render_template('index.html', prediction=prediction)
else:
return render_template('index.html',
prediction='Predictions will appear here!')
I want to replace the hardcoded sequences
variable on the POST method with the data inputted from the textarea
tag in the HTML.
Thanks for any help!