Spaces:
Running
Running
Upload myinfer_latest.py
Browse files- myinfer_latest.py +5 -5
myinfer_latest.py
CHANGED
@@ -161,10 +161,10 @@ def api_convert_voice():
|
|
161 |
created_files.append(input_audio_path)
|
162 |
|
163 |
#split audio
|
164 |
-
cut_vocal_and_inst(input_audio_path,spk_id)
|
165 |
print("audio splitting performed")
|
166 |
-
vocal_path = f"output/{split_model}/{spk_id}_input_audio_{unique_id}/vocals.wav"
|
167 |
-
inst = f"output/{split_model}/{spk_id}_input_audio_{unique_id}/no_vocals.wav"
|
168 |
|
169 |
output_path = convert_voice(spk_id, vocal_path, voice_transform,unique_id)
|
170 |
output_path1= combine_vocal_and_inst(output_path,inst,unique_id)
|
@@ -216,7 +216,7 @@ def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
|
|
216 |
print(output_audio_path)
|
217 |
return output_audio_path
|
218 |
|
219 |
-
def cut_vocal_and_inst(audio_path,spk_id):
|
220 |
|
221 |
vocal_path = "output/result/audio.wav"
|
222 |
os.makedirs("output/result", exist_ok=True)
|
@@ -224,7 +224,7 @@ def cut_vocal_and_inst(audio_path,spk_id):
|
|
224 |
#logs.append("Starting the audio splitting process...")
|
225 |
#yield "\n".join(logs), None, None
|
226 |
print("before executing splitter")
|
227 |
-
command = f"demucs --two-stems=vocals -n {split_model} {audio_path} -o output"
|
228 |
#result = subprocess.Popen(command.split(), stdout=subprocess.PIPE, text=True)
|
229 |
result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
230 |
if result.returncode != 0:
|
|
|
161 |
created_files.append(input_audio_path)
|
162 |
|
163 |
#split audio
|
164 |
+
cut_vocal_and_inst(input_audio_path,spk_id,unique_id)
|
165 |
print("audio splitting performed")
|
166 |
+
vocal_path = f"output/{spk_id}_{unique_id}/{split_model}/{spk_id}_input_audio_{unique_id}/vocals.wav"
|
167 |
+
inst = f"output/{spk_id}_{unique_id}/{split_model}/{spk_id}_input_audio_{unique_id}/no_vocals.wav"
|
168 |
|
169 |
output_path = convert_voice(spk_id, vocal_path, voice_transform,unique_id)
|
170 |
output_path1= combine_vocal_and_inst(output_path,inst,unique_id)
|
|
|
216 |
print(output_audio_path)
|
217 |
return output_audio_path
|
218 |
|
219 |
+
def cut_vocal_and_inst(audio_path,spk_id,unique_id):
|
220 |
|
221 |
vocal_path = "output/result/audio.wav"
|
222 |
os.makedirs("output/result", exist_ok=True)
|
|
|
224 |
#logs.append("Starting the audio splitting process...")
|
225 |
#yield "\n".join(logs), None, None
|
226 |
print("before executing splitter")
|
227 |
+
command = f"demucs --two-stems=vocals -n {split_model} {audio_path} -o -o output/{spk_id}_{unique_id}"
|
228 |
#result = subprocess.Popen(command.split(), stdout=subprocess.PIPE, text=True)
|
229 |
result = subprocess.run(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
230 |
if result.returncode != 0:
|