diff --git a/CHANGELOG.md b/CHANGELOG.md index b3f6fb850..992a432c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## develop +### New features + +- feat: add `"hidden"` option to `ProgressHook` + ### Fixes - fix: fix clipping issue in speech separation pipeline ([@joonaskalda](https://github.com/joonaskalda/)) diff --git a/pyannote/audio/pipelines/utils/hook.py b/pyannote/audio/pipelines/utils/hook.py index db6972e2e..836c9ed26 100644 --- a/pyannote/audio/pipelines/utils/hook.py +++ b/pyannote/audio/pipelines/utils/hook.py @@ -97,10 +97,14 @@ class ProgressHook: output = pipeline(file, hook=hook) """ - def __init__(self, transient: bool = False): + def __init__(self, transient: bool = False, hidden: bool = False): self.transient = transient + self.hidden = hidden def __enter__(self): + if self.hidden: + return self + self.progress = Progress( TextColumn("[progress.description]{task.description}"), BarColumn(), @@ -112,7 +116,11 @@ def __enter__(self): return self def __exit__(self, *args): + if self.hidden: + return + self.progress.stop() + return def __call__( self, @@ -122,6 +130,9 @@ def __call__( total: Optional[int] = None, completed: Optional[int] = None, ): + if self.hidden: + return + if completed is None: completed = total = 1