-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (18 loc) · 657 Bytes
/
app.py
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
37
38
39
# Importing essential libraries
from flask import Flask, render_template, request
from functions import preprocess
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['POST'])
def predict():
if request.method == 'POST':
inputtweet = request.form['tweet']
output = preprocess(inputtweet)
return render_template('result.html', prediction=int(output))
@app.route('/return',methods=['GET'])
def back():
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=9090)