1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Hugging Face

Connected

Exercise

Summarizing long text

Summarization reduces large text into manageable content, helping readers quickly grasp key points from lengthy articles or documents.

There are two main types: extractive, which selects key sentences from the original text, and abstractive, which generates new sentences summarizing main ideas.

In this exercise, you’ll create an abstractive summarization pipeline using Hugging Face's pipeline() function and the cnicu/t5-small-booksum model. You’ll summarize text from a Wikipedia page on Greece, comparing the abstractive model's rephrased output to the original.

The pipeline function from the transformers library and the original_text have already been loaded for you.

Instructions

100 XP
  • Create the summarization pipeline using the task "summarization" and save as summarizer.
  • Use the new pipeline to create a summary of the text and save as summary_text.
  • Compare the length of the original and summary text.