File size: 881 Bytes
d9fdfda
 
 
 
 
 
d45b0b7
d9fdfda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d45b0b7
d9fdfda
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# import modules
from flask import Flask, render_template, session, redirect, url_for
from flask_wtf import FlaskForm
from wtforms import SubmitField, TextAreaField

import env_variable
import mainn

app = Flask(__name__)

app.config['SECRET_KEY'] = env_variable.app_security_key

class TextForm(FlaskForm):
    text = TextAreaField('Text')
    submit = SubmitField('Send')


@app.route('/', methods=['GET', 'POST'])
def index():
    form = TextForm()
    if form.validate_on_submit():  # Check if form is submitted
        session['text'] = form.text.data
        return redirect(url_for("moderator"))
    return render_template('home.html', form=form)


@app.route('/moderator')
def moderator():
    text = session['text']
    result = mainn.content_moderator(text)
    return render_template('moderator.html', result=result)


if __name__ == '__main__':
    app.run(debug=True)