├── Procfile ├── vectorizer.pkl ├── requirements.txt ├── Screenshot (58).png ├── Screenshot (59).png ├── finalized_model.pkl ├── app.py ├── README.md ├── templates ├── prediction.html └── index.html ├── static └── image.svg ├── .ipynb_checkpoints └── Fake News Detection-checkpoint.ipynb └── Fake News Detection.ipynb /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn app:app 2 | -------------------------------------------------------------------------------- /vectorizer.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codejay411/Fake-News-Detection-App/HEAD/vectorizer.pkl -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codejay411/Fake-News-Detection-App/HEAD/requirements.txt -------------------------------------------------------------------------------- /Screenshot (58).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codejay411/Fake-News-Detection-App/HEAD/Screenshot (58).png -------------------------------------------------------------------------------- /Screenshot (59).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codejay411/Fake-News-Detection-App/HEAD/Screenshot (59).png -------------------------------------------------------------------------------- /finalized_model.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codejay411/Fake-News-Detection-App/HEAD/finalized_model.pkl -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | #Implement all this concept by machine learning with flask 2 | 3 | from flask import Flask, escape, request, render_template 4 | import pickle 5 | 6 | vector = pickle.load(open("vectorizer.pkl", 'rb')) 7 | model = pickle.load(open("finalized_model.pkl", 'rb')) 8 | 9 | app = Flask(__name__) 10 | 11 | @app.route('/') 12 | def home(): 13 | return render_template("index.html") 14 | 15 | @app.route('/prediction', methods=['GET', 'POST']) 16 | def prediction(): 17 | if request.method == "POST": 18 | news = str(request.form['news']) 19 | print(news) 20 | 21 | predict = model.predict(vector.transform([news]))[0] 22 | print(predict) 23 | 24 | return render_template("prediction.html", prediction_text="News headline is -> {}".format(predict)) 25 | 26 | 27 | else: 28 | return render_template("prediction.html") 29 | 30 | 31 | if __name__ == '__main__': 32 | app.debug = True 33 | app.run() 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About Fake News Detection Project 2 | 3 | This project is available for open source contribution 4 | 5 | ## Video link on youtube 6 | If you want a detailed explanation of this project, then feel free to go and watch videos. Make sure if you like the video then please subscribe to my channel.\ 7 | [Fake News Detection Using Machine Learning](https://www.youtube.com/watch?v=CUkggjNNoWs&list=PLA0J2h1KIAR7xoDbI1usGLVRW6_6qiLuq&index=19) 8 | 9 | ## Overview 10 | The topic of fake news detection on social media has recently attracted tremendous attention. The basic countermeasure of comparing websites against a list of labeled fake news sources is inflexible, and so a machine learning approach is desirable. Our project aims to use Machine learning algorithms to detect fake news directly, based on the text content of news articles. 11 | 12 | ## Problem Definition 13 | Develop a machine learning program to identify when a news source may be producing fake news. We aim to use a corpus of labeled real and fake news articles to build a classifier that can make decisions about information based on the content from the corpus. The model will focus on identifying fake news sources, based on multiple articles originating from a source. Once a source is labeled as a producer of fake news, we can predict with high confidence that any future articles from that source will also be fake news. Focusing on sources widens our article misclassification tolerance because we will have multiple data points coming from each source. 14 | 15 | The intended application of the project is for use in applying visibility weights in social media. Using weights produced by this model, social networks can make stories that are highly likely to be fake news less visible. 16 | 17 | Planning: - 18 | 1. Data Collection 19 | 2. Model Building 20 | 3. Backend work 21 | 4. Deployment 22 | 23 | ## Project link 24 | 25 | [Fake News Detection Using Machine Learning](https://youtu.be/CUkggjNNoWs) 26 | 27 | All parts available in playlist, 28 | channel name - [codejay](https://www.youtube.com/channel/UCZnkti7aeEmQ7CzumqEEsLg) 29 | 30 | ## Installation 31 | 32 | Use the package manager [pip](https://pip.pypa.io/en/stable/) to install library. 33 | 34 | ```bash 35 | pip install virtualenv 36 | ``` 37 | ```bash 38 | virtualenv env_name 39 | ``` 40 | ```bash 41 | env_name/scripts/activate 42 | ``` 43 | ## Start Project 44 | 45 | Follow these commands to start your project. 46 | 47 | ```bash 48 | pip install -r requirements.txt 49 | ``` 50 | ```bash 51 | python app.py 52 | ``` 53 | ## Home page 54 | 55 | .png) 56 | 57 | ## Prediction page 58 | 59 | .png) 60 | -------------------------------------------------------------------------------- /templates/prediction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |Whatever cardigan tote bag tumblr hexagon brooklyn asymmetrical gentrify, subway tile poke farm-to-table. Franzen you probably haven't heard of them man bun deep jianbing selfies heirloom prism food truck ugh squid celiac humblebrag.
37 |{{prediction_text}}
38 || \n", 78 | " | Unnamed: 0 | \n", 79 | "title | \n", 80 | "text | \n", 81 | "label | \n", 82 | "
|---|---|---|---|---|
| 0 | \n", 87 | "8476 | \n", 88 | "You Can Smell Hillary’s Fear | \n", 89 | "Daniel Greenfield, a Shillman Journalism Fello... | \n", 90 | "FAKE | \n", 91 | "
| 1 | \n", 94 | "10294 | \n", 95 | "Watch The Exact Moment Paul Ryan Committed Pol... | \n", 96 | "Google Pinterest Digg Linkedin Reddit Stumbleu... | \n", 97 | "FAKE | \n", 98 | "
| 2 | \n", 101 | "3608 | \n", 102 | "Kerry to go to Paris in gesture of sympathy | \n", 103 | "U.S. Secretary of State John F. Kerry said Mon... | \n", 104 | "REAL | \n", 105 | "
| 3 | \n", 108 | "10142 | \n", 109 | "Bernie supporters on Twitter erupt in anger ag... | \n", 110 | "— Kaydee King (@KaydeeKing) November 9, 2016 T... | \n", 111 | "FAKE | \n", 112 | "
| 4 | \n", 115 | "875 | \n", 116 | "The Battle of New York: Why This Primary Matters | \n", 117 | "It's primary day in New York and front-runners... | \n", 118 | "REAL | \n", 119 | "
| \n", 78 | " | Unnamed: 0 | \n", 79 | "title | \n", 80 | "text | \n", 81 | "label | \n", 82 | "
|---|---|---|---|---|
| 0 | \n", 87 | "8476 | \n", 88 | "You Can Smell Hillary’s Fear | \n", 89 | "Daniel Greenfield, a Shillman Journalism Fello... | \n", 90 | "FAKE | \n", 91 | "
| 1 | \n", 94 | "10294 | \n", 95 | "Watch The Exact Moment Paul Ryan Committed Pol... | \n", 96 | "Google Pinterest Digg Linkedin Reddit Stumbleu... | \n", 97 | "FAKE | \n", 98 | "
| 2 | \n", 101 | "3608 | \n", 102 | "Kerry to go to Paris in gesture of sympathy | \n", 103 | "U.S. Secretary of State John F. Kerry said Mon... | \n", 104 | "REAL | \n", 105 | "
| 3 | \n", 108 | "10142 | \n", 109 | "Bernie supporters on Twitter erupt in anger ag... | \n", 110 | "— Kaydee King (@KaydeeKing) November 9, 2016 T... | \n", 111 | "FAKE | \n", 112 | "
| 4 | \n", 115 | "875 | \n", 116 | "The Battle of New York: Why This Primary Matters | \n", 117 | "It's primary day in New York and front-runners... | \n", 118 | "REAL | \n", 119 | "
Copper mug try-hard pitchfork pour-over freegan heirloom neutra air plant cold-pressed tacos poke beard tote bag. Heirloom echo park mlkshk tote bag selvage hot chicken authentic tumeric truffaut hexagon try-hard chambray.
38 | 42 |Synth chartreuse iPhone lomo cray raw denim brunch everyday carry neutra before they sold out fixie 90's microdosing. Tacos pinterest fanny pack venmo, post-ironic heirloom try-hard pabst authentic iceland.
58 | 59 |Synth chartreuse iPhone lomo cray raw denim brunch everyday carry neutra before they sold out fixie 90's microdosing. Tacos pinterest fanny pack venmo, post-ironic heirloom try-hard pabst authentic iceland.
73 | 74 |Blue bottle crucifix vinyl post-ironic four dollar toast vegan taxidermy. Gastropub indxgo juice poutine, ramps microdosing banh mi pug VHS try-hard ugh iceland kickstarter tumblr live-edge tilde.
100 | Learn More 101 | 104 | 105 |Blue bottle crucifix vinyl post-ironic four dollar toast vegan taxidermy. Gastropub indxgo juice poutine, ramps microdosing banh mi pug VHS try-hard ugh iceland kickstarter tumblr live-edge tilde.
118 | Learn More 119 | 122 | 123 |Blue bottle crucifix vinyl post-ironic four dollar toast vegan taxidermy. Gastropub indxgo juice poutine, ramps microdosing banh mi pug VHS try-hard ugh iceland kickstarter tumblr live-edge tilde.
135 | Learn More 136 | 139 | 140 |