Let’s build a text classifier with TensorFlow + Python!

Manpreet Singh
3 min readAug 15, 2021

Welcome back! Python is an awesome programming language with tons of machine learning packages, one of these packages is TensorFlow, so let’s build out a sample project using Python and TensorFlow! Now, this project is already completely built out and hosted on the official TensorFlow website, here is a link to this project below:

The remainder of this article is going to walkthrough this project, you can also run this project on Google Colab from the link above. This project utilizes several different packages, we use TensorFlow, Numpy and matplotlib, we start off by importing our packages like this:

import numpy as np

import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_datasets as tfds

import matplotlib.pyplot as plt

print("Version: ", tf.__version__)
print("Eager mode: ", tf.executing_eagerly())
print("Hub version: ", hub.__version__)
print("GPU is", "available" if tf.config.list_physical_devices('GPU') else "NOT AVAILABLE")

Next up we want to download a dataset, for this project we’ll be using a dataset from…

--

--

Manpreet Singh
Manpreet Singh

No responses yet