From 3adcc12d0f91369446a624e33185c555facc8ed2 Mon Sep 17 00:00:00 2001 From: Guillaume Klein Date: Thu, 13 Apr 2023 09:50:53 +0200 Subject: [PATCH] Clarify that the returned segments value is a generator (#144) * Clarify that the returned segments value is a generator * Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index a2adf26..02a2be6 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,13 @@ for segment in segments: print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text)) ``` +**Warning:** `segments` is a *generator* so the transcription only starts when you iterate over it. The transcription can be run to completion by gathering the segments in a list or a `for` loop: + +```python +segments, _ = model.transcribe("audio.mp3") +segments = list(segments) # The transcription will actually run here. +``` + #### Word-level timestamps ```python