forked from nishitpatel01/Fake_News_Detection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprediction.py
More file actions
28 lines (19 loc) · 694 Bytes
/
prediction.py
File metadata and controls
28 lines (19 loc) · 694 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
28
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 4 17:45:40 2017
@author: NishitP
"""
import pickle
#doc_new = ['obama is running for president in 2016']
var = input("Please enter the news text you want to verify: ")
print("You entered: " + str(var))
#function to run for prediction
def detecting_fake_news(var):
#retrieving the best model for prediction call
load_model = pickle.load(open('final_model.sav', 'rb'))
prediction = load_model.predict([var])
prob = load_model.predict_proba([var])
return (print("The given statement is ",prediction[0]),
print("The truth probability score is ",prob[0][1]))
if __name__ == '__main__':
detecting_fake_news(var)