-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
31 lines (25 loc) · 745 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
#!flask/bin/python
from flask import Flask, request, render_template
from flask_bootstrap import Bootstrap
import pickle
import app_utilities
app = Flask(__name__)
Bootstrap(app)
@app.route('/')
def index():
return render_template('index1.html')
@app.route('/predict', methods=['POST'])
def predict():
"""
Collect the input and predict the outcome
Returns:
Results.html with prediction
"""
if request.method == 'POST':
# get input statement
tweet = request.form["tweet"]
data = [tweet]
my_prediction = app_utilities.tweet_prediction(str(data))
return render_template("result.html", prediction=my_prediction, name=tweet)
if __name__ == '__main__':
app.run(debug=True)