Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files- myinfer_latest.py +8 -3
myinfer_latest.py
CHANGED
|
@@ -165,7 +165,7 @@ def api_convert_voice():
|
|
| 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)
|
| 171 |
|
|
@@ -199,6 +199,9 @@ def get_processed_audio(audio_id):
|
|
| 199 |
|
| 200 |
def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
|
| 201 |
get_vc(spk_id,0.5)
|
|
|
|
|
|
|
|
|
|
| 202 |
output_audio_path = vc_single(
|
| 203 |
sid=0,
|
| 204 |
input_audio_path=input_audio_path,
|
|
@@ -287,7 +290,8 @@ def vc_single(
|
|
| 287 |
unique_id
|
| 288 |
): # spk_item, input_audio0, vc_transform0,f0_file,f0method0
|
| 289 |
global tgt_sr, net_g, vc, hubert_model, version, cpt
|
| 290 |
-
|
|
|
|
| 291 |
try:
|
| 292 |
logs = []
|
| 293 |
print(f"Converting...")
|
|
@@ -331,9 +335,10 @@ def vc_single(
|
|
| 331 |
print("writing to FS")
|
| 332 |
#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed
|
| 333 |
# Assuming 'unique_id' is passed to convert_voice function along with 'sid'
|
|
|
|
| 334 |
output_file_path = os.path.join("output", f"converted_audio_{sid}_{unique_id}.wav") # Adjust path as needed
|
| 335 |
|
| 336 |
-
|
| 337 |
os.makedirs(os.path.dirname(output_file_path), exist_ok=True) # Create the output directory if it doesn't exist
|
| 338 |
print("create dir")
|
| 339 |
# Save the audio file using the target sampling rate
|
|
|
|
| 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 |
+
print("*****before making call to convert ", unique_id)
|
| 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)
|
| 171 |
|
|
|
|
| 199 |
|
| 200 |
def convert_voice(spk_id, input_audio_path, voice_transform,unique_id):
|
| 201 |
get_vc(spk_id,0.5)
|
| 202 |
+
print("*****before makinf call to vc ", unique_id)
|
| 203 |
+
|
| 204 |
+
|
| 205 |
output_audio_path = vc_single(
|
| 206 |
sid=0,
|
| 207 |
input_audio_path=input_audio_path,
|
|
|
|
| 290 |
unique_id
|
| 291 |
): # spk_item, input_audio0, vc_transform0,f0_file,f0method0
|
| 292 |
global tgt_sr, net_g, vc, hubert_model, version, cpt
|
| 293 |
+
print("***** in vc ", unique_id)
|
| 294 |
+
|
| 295 |
try:
|
| 296 |
logs = []
|
| 297 |
print(f"Converting...")
|
|
|
|
| 335 |
print("writing to FS")
|
| 336 |
#output_file_path = os.path.join("output", f"converted_audio_{sid}.wav") # Adjust path as needed
|
| 337 |
# Assuming 'unique_id' is passed to convert_voice function along with 'sid'
|
| 338 |
+
print("***** before writing to file outout ", unique_id)
|
| 339 |
output_file_path = os.path.join("output", f"converted_audio_{sid}_{unique_id}.wav") # Adjust path as needed
|
| 340 |
|
| 341 |
+
print("******* output file path ",output_file_path)
|
| 342 |
os.makedirs(os.path.dirname(output_file_path), exist_ok=True) # Create the output directory if it doesn't exist
|
| 343 |
print("create dir")
|
| 344 |
# Save the audio file using the target sampling rate
|