-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
32 lines (22 loc) · 750 Bytes
/
main.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
from flask import Flask,render_template,request
import pickle
import os
app = Flask(__name__)
pipe = pickle.load(open("Naive_model.pkl","rb"))
@app.route('/', methods=["GET","POST"])
def main_function():
if request.method == "POST":
text = request.form
# print(text)
emails = text['email']
print(emails)
list_email = [emails]
# print(list_email)
output = pipe.predict(list_email)[0]
print(output)
return render_template("show.html", prediction = output)
else:
return render_template("index.html")
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)