Skip to content

Commit

Permalink
doc: add progress hook in README.md example (#1826)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaGulya authored Feb 4, 2025
1 parent d6136a8 commit 74705e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Consider switching to [pyannoteAI](https://www.pyannote.ai) for better and faste

```python
from pyannote.audio import Pipeline
from pyannote.audio.pipelines.utils.hook import ProgressHook

pipeline = Pipeline.from_pretrained(
"pyannote/speaker-diarization-3.1",
token="HUGGINGFACE_ACCESS_TOKEN_GOES_HERE")
Expand All @@ -26,8 +28,9 @@ pipeline = Pipeline.from_pretrained(
import torch
pipeline.to(torch.device("cuda"))

# apply pretrained pipeline
diarization = pipeline("audio.wav")
# apply pretrained pipeline (with optional progress hook)
with ProgressHook() as hook:
diarization = pipeline("audio.wav", hook=hook)

# print the result
for turn, _, speaker in diarization.itertracks(yield_label=True):
Expand Down

0 comments on commit 74705e9

Please sign in to comment.