mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
feat: add "hidden" option to ProgressHook (#1761)
This commit is contained in:
1 parent
583251059d
commit
5ae7a48dd2
2 files changed
+16
-1
No files matched your search
@@ -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/))
|
||||
|
||||
@@ -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 @@ class ProgressHook:
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
if self.hidden:
|
||||
return
|
||||
|
||||
self.progress.stop()
|
||||
return
|
||||
|
||||
def __call__(
|
||||
self,
|
||||
@@ -122,6 +130,9 @@ class ProgressHook:
|
||||
total: Optional[int] = None,
|
||||
completed: Optional[int] = None,
|
||||
):
|
||||
if self.hidden:
|
||||
return
|
||||
|
||||
if completed is None:
|
||||
completed = total = 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user