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

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

This tab will not be visible to users.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]