-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.py
36 lines (25 loc) · 948 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
from flask import Flask, render_template, url_for, request
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.externals import joblib
import io
import numpy as np # Import Numpy for data statistical analysis
import matplotlib.pyplot as plt # Import matplotlib for data visualisation
import pandas as pd
import seaborn as sns
from sklearn.model_selection import KFold
import pickle
# Machine Learning model
model = pickle.load( open('model.pkl','rb'))
app = Flask(__name__)
@app.route('/')
def home():
return render_template("index.html")
@app.route('/predict', methods=["GET", "POST"])
def predict():
# Features and Labels
# df['label'] = df['class'].map({'ham': 0, 'spam': 1})
# X = df['message']
# y = df['label']
print(model.predict([[11.8,3,4,4,4,4,4,4,4,4,4]]))
return render_template("predict.html")