black reformat

This commit is contained in:
shahules786 2022-10-05 11:21:30 +05:30
parent c256b5478e
commit e8b5e343c7
1 changed files with 4 additions and 5 deletions

View File

@ -28,7 +28,7 @@ class Inference:
if isinstance(audio, (np.ndarray, torch.Tensor)): if isinstance(audio, (np.ndarray, torch.Tensor)):
assert sr is not None, "Invalid sampling rate!" assert sr is not None, "Invalid sampling rate!"
if len(audio.shape) == 1: if len(audio.shape) == 1:
audio = audio.reshape(1,-1) audio = audio.reshape(1, -1)
if isinstance(audio, str): if isinstance(audio, str):
audio = Path(audio) audio = Path(audio)
@ -105,8 +105,7 @@ class Inference:
window = get_window(window=window, Nx=data.shape[-1]) window = get_window(window=window, Nx=data.shape[-1])
window = torch.from_numpy(window).to(data.device) window = torch.from_numpy(window).to(data.device)
data *= window data *= window
step_size = window_size//2 if step_size is None else step_size step_size = window_size // 2 if step_size is None else step_size
data = data.permute(1, 2, 0) data = data.permute(1, 2, 0)
data = F.fold( data = F.fold(
@ -134,8 +133,8 @@ class Inference:
if isinstance(filename, str): if isinstance(filename, str):
filename = Path(filename) filename = Path(filename)
parent, name = filename.parent, "cleaned_"+filename.name parent, name = filename.parent, "cleaned_" + filename.name
filename = parent/Path(name) filename = parent / Path(name)
if filename.is_file(): if filename.is_file():
raise FileExistsError(f"file {filename} already exists") raise FileExistsError(f"file {filename} already exists")
else: else: