Clarify that the returned segments value is a generator (#144)

* Clarify that the returned segments value is a generator

* Update README.md
This commit is contained in:
Guillaume Klein
2023-04-13 09:50:53 +02:00
committed by GitHub
parent 2b53dee6b6
commit 3adcc12d0f

View File

@@ -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