Difficulty: beginner
Estimated Time: 20 minutes

TensorFlow is the platform enabling building deep Neural Network architectures and performing Deep Learning. Natural Language Processing is the class of problems of using and processing text. This tutorial introduces the basics needed to perform text generation.

In this scenario, you will learn how to use TensorFlow and Keras for text generation. The content is based on the official Text generation tutorial.

To take the most of this course, you should know how to program in Python or other languages that would allow you to understand Python syntax. Knowledge on TensorFlow is also valuable.


You've completed Sentiment Analysis scenario.

You've learned how to:

  • Create a Keras model
  • Train the model
  • Use the model for text generation

Text generation

Step 1 of 6

Importing packages

To start working with Python shell run the following command:


You can use quit() to leave it.

To start working you should first import TensorFlow and enable eager execution:

import tensorflow as tf tf.enable_eager_execution()

Than we can import other useful packages: import numpy as np import os

Some of the helper functions has been defined in the help package. The package contains mostly functions to load the data.

import help