From ab6ca173edbb9e39fd1fc87d984669f023b18da0 Mon Sep 17 00:00:00 2001 From: Anjok07 <68268275+Anjok07@users.noreply.github.com> Date: Thu, 7 Apr 2022 19:10:06 -0500 Subject: [PATCH] Add files via upload --- VocalRemover.py | 5 +++++ inference_v5.py | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/VocalRemover.py b/VocalRemover.py index 5b1cfbb..7ac7f56 100644 --- a/VocalRemover.py +++ b/VocalRemover.py @@ -547,6 +547,11 @@ class MainWindow(TkinterDnD.Tk): message='You have selected an invalid music file! Please make sure that the file still exists!', detail=f'File path: {path}') return + if not os.path.isfile(instrumentalModel_path): + tk.messagebox.showwarning(master=self, + title='Invalid Main Model File', + message='You have selected an invalid main model file!\nPlease make sure that your model file still exists!') + return if not os.path.isdir(export_path): tk.messagebox.showwarning(master=self, title='Invalid Export Directory', diff --git a/inference_v5.py b/inference_v5.py index 190f683..09c6d06 100644 --- a/inference_v5.py +++ b/inference_v5.py @@ -109,9 +109,11 @@ class VocalRemover(object): pred = pred.detach().cpu().numpy() preds.append(pred[0]) - + pred = np.concatenate(preds, axis=2) + + return pred def preprocess(self, X_spec): @@ -197,7 +199,7 @@ def update_progress(progress_var, total_files, file_num, step: float = 1): """Calculate the progress for the progress widget in the GUI""" base = (100 / total_files) progress = base * (file_num - 1) - progress += step + progress += base * step progress_var.set(progress) @@ -306,8 +308,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress base_text = get_baseText(total_files=len(data['input_paths']), file_num=file_num) progress_kwargs = {'progress_var': progress_var, - 'total_files': len(data['input_paths']), - 'file_num': file_num} + 'total_files': len(data['input_paths']), + 'file_num': file_num} update_progress(**progress_kwargs, step=0) @@ -397,14 +399,14 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress text_widget.write(base_text + 'Done!\n') update_progress(**progress_kwargs, - step=0.7) + step=1) # Save output music files text_widget.write(base_text + 'Saving Files...\n') save_files(wav_instrument, wav_vocals) text_widget.write(base_text + 'Done!\n') update_progress(**progress_kwargs, - step=0.8) + step=1) # Save output image if data['output_image']: