From 7bcc344a93c8f4e8af25a2c1db5073a1474948f0 Mon Sep 17 00:00:00 2001 From: Yixiao Zhang Date: Fri, 28 Jul 2023 16:28:51 +0900 Subject: [PATCH] bug fix --- melodytalk/modules.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/melodytalk/modules.py b/melodytalk/modules.py index 97db424..370f97e 100644 --- a/melodytalk/modules.py +++ b/melodytalk/modules.py @@ -219,9 +219,10 @@ def inference(self, inputs): print(f"{mode} {instrument} track from {music_filename}.") if mode == "extract": - instrument_mode = instrument + instrument_mode = instrument_mode_file = instrument elif mode == "remove": instrument_mode = f"no{instrument}" + instrument_mode_file = f"no_{instrument}" else: raise ValueError("mode must be `extract` or `remove`.") @@ -234,13 +235,13 @@ def inference(self, inputs): demucs.separate.main(self.params_list) # rename copyfile( - os.path.join("separated", "htdemucs_6s", music_filename[:-4].split("/")[-1],f"{instrument_mode}.wav"), + os.path.join("separated", "htdemucs_6s", music_filename[:-4].split("/")[-1],f"{instrument_mode_file}.wav"), updated_music_filename ) # delete the folder # os.system(f"rm -rf {os.path.join('separated', 'htdemucs_6s')}") - print(f"Processed Source Separation, Input Music: {music_filename}, Output Instrument: {instrument_mode}.") + print(f"Processed Source Separation, Input Music: {music_filename}, Output Instrument: {instrument_mode_file}.") return updated_music_filename