Coder Social home page Coder Social logo

ac4mm / fake-detector Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 31.89 MB

A fine-tuning BERT model for detect and to binary classify fake news articles.

Python 11.47% Jupyter Notebook 87.38% CSS 0.34% HTML 0.81%
nlp natural-language-processing bert tensorflow fake-news machine-learning

fake-detector's Introduction

Fake-Detector

A fine-tuning BERT model for detect and to binary classify fake news articles.

Getting Started

This release tries to classify fake news in fake or not-fake (binary classification) in a simple web app (Fake-Detector) with micro-framework Flask. It use BERT (Google) as pre-training model and It has been fine-tuned in a specific model, trained by two different dataset (AG News and fake). I merged the two datasets keeping two columns: text | type; text shows me articles while type could be 0 (news) or 1 (fake news). It has achieved an 0,99 accuracy in test set and exploited this accuracy result to this binary article classification.

Prerequisites

First needs to install this requirements:

  • torch
  • numpy
  • flask
  • Jinja2

Demo

After that, you must get secret_key for Flask session and change it at line 12 in app.py file. Then, you must simple run with:

python app.py

After that, you could see different "FutureWarning: Passing (type,1) ..." caused by a version of numpy. You can simply ignore it. Finally you will see Fake-Detector to classify a text of article with a score for a fake or not-fake. Below you can see a demo image of homepage and an examples score about a The Onion's article.
 

Built With

 

Acknowledgments

  • @jalammar, for his fantastic visual article about Transformer (useful for grasp BERT) Jay Alammar .
  • @chrisjmccormick for his amazing BERT Research Series.

fake-detector's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

fake-detector's Issues

Error when running #Evaluate:

"Code_colab":
#Evaluate
BERT_MODEL = 'fake-news.tar.gz', a = b, where did this come from???
So, I got this error:
ERROR:pytorch_pretrained_bert.modeling:Model name 'cache/fake-news.tar.gz' was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese). We assumed 'cache/fake-news.tar.gz' was a path or url but couldn't find any file associated to this path or url.
I look forward to your explanation, thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.