We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b569f3b commit a5f9182Copy full SHA for a5f9182
Fake-News-Detector/app.py
@@ -0,0 +1,23 @@
1
+import pickle
2
+from flask import Flask, request, render_template
3
+
4
+app = Flask(__name__)
5
+model = pickle.load(open('pac.pkl', 'rb'))
6
+tfidf = pickle.load(open('tfidf_vectorizer.pkl','rb'))
7
8
+@app.route('/')
9
+def home():
10
+ return render_template('home.html')
11
12
13
+@app.route('/predict',methods=['POST'])
14
+def predict():
15
+ if request.method == 'POST':
16
+ news = request.form['news']
17
+ data = [news]
18
+ vect = tfidf.transform(data)
19
+ my_prediction = model.predict(vect)
20
+ return render_template('prediction.html', prediction=my_prediction)
21
22
+if __name__ == '__main__':
23
+ app.run(debug=True)
0 commit comments