Creating summarized chapters from podcasts

The Auto Chapters model summarizes audio data over time into chapters. Chapters makes it easy for users to navigate and find specific information. Each chapter contains the following:

  • Summary
  • One-line gist
  • Headline
  • Start and end timestamps

In this step-by-step guide, you’ll learn how to apply the model. You’ll send the auto_chapters parameter in your request, and then use chapters property from the response.

You can also learn the content on this page from Automatic Chapter Detection With AssemblyAI on AssemblyAI’s YouTube channel.

Get started

Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for a free account and get your API key from your dashboard.

The entire source code of this guide can be viewed here.

Here’s an audio example for this guide:

$https://assembly.ai/wildfires.mp3

Step-by-step instructions

1

Install the SDK.

1pip install -U assemblyai
2

Import the assemblyai package and set the API key.

1import assemblyai as aai
2
3aai.settings.api_key = "<YOUR_API_KEY>"
3

Create a TranscriptionConfig with auto_chapters set to True.

1# highlight-next-line
2config = aai.TranscriptionConfig(auto_chapters=True)
4

Create a Transcriber object and pass in the configuration.

1transcriber = aai.Transcriber(config=config)
5

Pass the URL or file path to Transcriber.transcribe(). You can access the transcript from the returned Transcript object.

1FILE_URL = "https://assembly.ai/wildfires.mp3"
2
3transcript = transcriber.transcribe(FILE_URL)
6

You can access the chapter results from the chapters attribute in the transcript.

1for chapter in transcript.chapters:
2 print("Chapter Start Time:", chapter.start)
3 print("Chapter End Time:", chapter.end)
4 print("Chapter Gist:", chapter.gist)
5 print("Chapter Headline:", chapter.headline)
6 print("Chapter Summary:", chapter.summary)

Understanding the response

Your automatic chapters are located in the chapters key of the API response. Each entry contains a summary of the chapter, a one-line gist and a chapter headline, and start and end timestamps.

Conclusion

Creating text summaries using our Auto Chapters functionality works on all kinds of different input sources, not just podcasts. For example, you can use it to summarize lecture videos or other long-form content.

If you need more fine-grained control than Auto Chapters offers, you can use AssemblyAI’s Summarization model to customize the complexity of your summary.

Was this page helpful?
Built with