diff --git a/pyannote/audio/pipelines/utils/hook.py b/pyannote/audio/pipelines/utils/hook.py index 443ef9ac..cb150ea4 100644 --- a/pyannote/audio/pipelines/utils/hook.py +++ b/pyannote/audio/pipelines/utils/hook.py @@ -51,6 +51,11 @@ def logging_hook( class ProgressHook: """Hook to show progress of each internal step + Parameters + ---------- + transient: bool, optional + Clear the progress on exit. Defaults to False. + Example ------- pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization") @@ -58,6 +63,10 @@ class ProgressHook: output = pipeline(file, hook=hook) """ + def __init__(self, transient: bool = False): + super().__init__() + self.transient = transient + def __enter__(self): self.progress = Progress( @@ -65,6 +74,7 @@ class ProgressHook: BarColumn(), TaskProgressColumn(), TimeRemainingColumn(elapsed_when_finished=True), + transient=self.transient, ) self.progress.start() return self