Skip to content

Commit

Permalink
doc: add progress hooks in README.md example
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaGulya committed Jan 10, 2025
1 parent 3c167f2 commit 15b954c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion 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 Hooks, ProgressHook, TimingHook

pipeline = Pipeline.from_pretrained(
"pyannote/speaker-diarization-3.1",
use_auth_token="HUGGINGFACE_ACCESS_TOKEN_GOES_HERE")
Expand All @@ -27,7 +29,8 @@ import torch
pipeline.to(torch.device("cuda"))

# apply pretrained pipeline
diarization = pipeline("audio.wav")
with Hooks(ProgressHook(), TimingHook()) 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 15b954c

Please sign in to comment.