-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
THIS is complete project of our new model
- Loading branch information
1 parent
f9737f2
commit 651f321
Showing
11 changed files
with
12,920 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from flask import Flask, render_template, request | ||
import pandas as pd | ||
import sklearn | ||
import itertools | ||
import numpy as np | ||
import seaborn as sb | ||
import re | ||
import nltk | ||
import pickle | ||
from sklearn.feature_extraction.text import TfidfVectorizer | ||
from matplotlib import pyplot as plt | ||
from sklearn.linear_model import PassiveAggressiveClassifier | ||
from nltk.stem import WordNetLemmatizer | ||
from nltk.corpus import stopwords | ||
|
||
app = Flask(__name__,template_folder='./templates',static_folder='./static') | ||
|
||
loaded_model = pickle.load(open('model.pkl', 'rb')) | ||
lemmatizer = WordNetLemmatizer() | ||
stpwrds = set(stopwords.words('english')) | ||
tfidf_v = TfidfVectorizer() | ||
corpus = [] | ||
|
||
def fake_news_det(news): | ||
review = news | ||
review = re.sub(r'[^a-zA-Z\s]', '', review) | ||
review = review.lower() | ||
review = nltk.word_tokenize(review) | ||
for y in review : | ||
if y not in stpwrds : | ||
corpus.append(lemmatizer.lemmatize(y)) | ||
input_data = [' '.join(corpus)] | ||
vectorized_input_data = tfidf_v.transform(input_data) | ||
prediction = loaded_model.predict(vectorized_input_data) | ||
if prediction[0] == 0: | ||
print("Prediction of the News : Looking Fake⚠ News📰 ") | ||
else: | ||
print("Prediction of the News : Looking Real News📰 ") | ||
|
||
@app.route('/') | ||
def home(): | ||
return render_template('index.html') | ||
|
||
|
||
|
||
@app.route('/predict', methods=['POST']) | ||
def predict(): | ||
if request.method == 'POST': | ||
message = request.form['news'] | ||
pred = fake_news_det(message) | ||
print(pred) | ||
return render_template('index.html', prediction=pred) | ||
else: | ||
return render_template('index.html', prediction="Something went wrong") | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* liScroll styles */ | ||
|
||
.tickercontainer{width:100%; height:30px; margin:0; padding:0; overflow:hidden; padding-top:2px} | ||
.tickercontainer .mask{left:10px; overflow:hidden; position:relative; top:0; width:100%; height:20px; overflow:hidden; margin-top:4px} | ||
ul.newsticker{position:relative; left:750px; font:bold 10px Verdana; list-style-type:none; margin:0; padding:0} | ||
ul.newsticker li{float:left; margin:0; padding:0} | ||
ul.newsticker a{white-space:nowrap; padding:0; color:#fff; margin:0 50px 0 0} | ||
ul.newsticker a:hover{text-decoration:underline} | ||
ul.newsticker span{margin:0 10px 0 0} | ||
ul.newsticker a > img{height:20px; margin-right:5px; width:25px} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
body | ||
{ | ||
background-image: url(https://cdn.hipwallpaper.com/i/55/28/yTersM.jpg); | ||
} | ||
.fnd | ||
{ | ||
text-align: center; | ||
color: #d62750; | ||
font-size: 2.0em; | ||
margin-top: 0px; | ||
|
||
} | ||
.how | ||
{ | ||
margin-left: 250px; | ||
padding-top: ; | ||
font-size: 30px; | ||
color: #ccbf87; | ||
} | ||
|
||
.name{ | ||
align-content: center; | ||
width: 50%; | ||
height: 150px; | ||
margin-left: 250px; | ||
margin-top: 10px; | ||
padding: 12px 20px; | ||
box-sizing: border-box; | ||
border: 2px solid #ccc; | ||
border-radius: 4px; | ||
background-color: #f8f8f8; | ||
resize: none; | ||
} | ||
|
||
.btn-success | ||
{ | ||
margin-left: 250px; | ||
background: ; | ||
height: 40px; | ||
width: 100px; | ||
font-size: 1.5em; | ||
border-radius: 10px; | ||
border-color: #0a58ca; | ||
|
||
} | ||
.btn-primary | ||
{ | ||
margin-left: 250px; | ||
background: red; | ||
height: 40px; | ||
width: 100px; | ||
font-size: 1.5em; | ||
border-radius: 10px; | ||
|
||
} | ||
|
||
#prediction | ||
{ | ||
margin-left: 250px; | ||
font-size: 1.5em; | ||
color: #ccffff; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.scrollToTop{background-color:#d083cf; color:#fff} | ||
.scrollToTop:hover, .scrollToTop:focus{background-color:#fff; color:#d083cf; border-color:1px solid #d083cf} | ||
.logo > span{color:#d083cf} | ||
.navbar-inverse .navbar-nav > li > a:hover, .navbar-inverse .navbar-nav > li > a:focus{background-color:#d083cf} | ||
.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:hover, .navbar-inverse .navbar-nav > .active > a:focus{background-color:#d083cf} | ||
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus{background-color:#d083cf} | ||
.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus{background-color:#d083cf} | ||
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus{background-color:#d083cf} | ||
.navbar-inverse .navbar-nav > .open > a, .navbar-inverse .navbar-nav > .open > a:hover, .navbar-inverse .navbar-nav > .open > a:focus{background-color:#d083cf} | ||
.latest_newsarea span{background:none repeat scroll 0 0 #d083cf} | ||
.latest_post > h2 span{background:none repeat scroll 0 0 #d083cf} | ||
#prev-button{color:#d083cf} | ||
#next-button{color:#d083cf} | ||
.single_post_content > h2 span{background:none repeat scroll 0 0 #d083cf} | ||
.single_sidebar > h2 span{ background:none repeat scroll 0 0 #d083cf} | ||
.bsbig_fig figcaption a:hover{color:#d083cf} | ||
.spost_nav .media-body > a:hover{color:#d083cf} | ||
.cat-item a:hover{background-color:#d083cf} | ||
.nav-tabs > li > a:hover, .nav-tabs > li > a:focus{background-color:#d083cf} | ||
.nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus{background-color:#d083cf} | ||
.single_sidebar > ul > li a:hover{color:#d083cf} | ||
.footer_widget > h2:hover{color:#d083cf} | ||
.tag_nav li a:hover{color:#d083cf; border-color:#d083cf} | ||
.copyright a:hover{color:#d083cf} | ||
.post_commentbox a:hover, .post_commentbox span:hover{color:#d083cf} | ||
.breadcrumb{border-left:10px solid #d083cf} | ||
.single_page_content ul li:before{background-color:#d083cf} | ||
.single_page_content h2, .single_page_content h3, .single_page_content h4, .single_page_content h5, .single_page_content h6{color:#d083cf} | ||
.nav-slit .icon-wrap{background-color:#d083cf} | ||
.nav-slit h3{background:#d083cf} | ||
.catgArchive{background-color:#d083cf} | ||
.error_page > h3{color:#d083cf} | ||
.error_page > span{background:none repeat scroll 0 0 #d083cf} | ||
.error_page > a{background-color:#d083cf} | ||
.contact_area > h2{background-color:#d083cf} | ||
.contact_form input[type="submit"]{background-color:#d083cf} | ||
.contact_form input[type="submit"]:hover{background-color:#fff; color:#d083cf} | ||
.related_post > h2 i{color:#d083cf} | ||
.form-control:focus{border-color:#d083cf; box-shadow:0 0px 1px #d083cf inset,0 0 5px #d083cf} |