Fake news has become a huge issue in our digitally-connected world and it is no longer limited to little squabbles! fake news spreads like wildfire and is impacting millions of people every day.
How do you deal with such a sensitive issue? Countless articles are being churned out every day on the internet -- how do you tell real from fake? It's not as easy as turning to a simple fact-checker which is typically built on a story-by-story basis. As developers, can we turn to machine learning?
Read the detailed article here: https://dev.to/twilio/fake-news-foe-machine-learning-and-twilio-5fln
We will be building a WhatsApp based service which will accept news headlines from the user and predict if given news is fake news or not.
-
A Twilio account --- sign up for a free one here
-
A Twilio whatsapp sandbox --- configure one here
-
Set up your Python and Flask developer environment --- Make sure you have Python 3 downloaded as well as ngrok.
-
Tensorflow
-
Run
pip install -r requirements.txt
Run app.py
- Your Flask app will need to be visible from the web so Twilio can send requests to it. Ngrok lets us do this. With it installed, run the following command in your terminal in the directory your code is in. Run
ngrok http 5000
in a new terminal tab.
- Grab that ngrok URL to configure twilio whatsapp sandbox. We will try this on WhatsApp! So let’s go ahead and do it (either on our Sandbox if you want to do testing or your main WhatsApp Sender number if you have one provisioned). In a screenshot below we show the Sandbox page:
And we’re good to go! Let’s test our application on WhatsApp! We can send some news headlines or facts to this sandbox and get predictions in return if everything works as expected.
Hurray! You wanna try this? Complete code is available on GitHub.