-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.py
More file actions
27 lines (21 loc) · 715 Bytes
/
app.py
File metadata and controls
27 lines (21 loc) · 715 Bytes
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
from flask import Flask,render_template,request
import pickle
classifier = pickle.load(open('model.pkl','rb'))
cv = pickle.load(open('cv.pkl','rb'))
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/chatbot')
def chatbot():
return render_template('chatbot.html')
@app.route('/predict',methods=['POST'])
def predict():
if request.method == 'POST':
message = request.form['message']
data = [message]
vect = cv.transform(data).toarray()
my_predict = classifier.predict(vect)
return render_template('result.html',prediction=my_predict)
if __name__ == '__main__':
app.run(host='0.0.0.0',port=5000,debug=True)