Spaces:
Runtime error
Runtime error
kevinwang676
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -428,7 +428,7 @@ def rvc_models(model_name):
|
|
428 |
singers="您的专属AI歌手阵容:"
|
429 |
|
430 |
@spaces.GPU(duration=80)
|
431 |
-
def infer_gpu(
|
432 |
from fairseq import checkpoint_utils
|
433 |
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
434 |
["hubert_base.pt"],
|
@@ -482,12 +482,15 @@ def rvc_infer_music(url, model_name, song_name, split_model, f0_up_key, vocal_vo
|
|
482 |
if os.path.isdir(f"./output/{split_model}/{song_id}")==True:
|
483 |
print("2.直接开始推理")
|
484 |
audio, sr = librosa.load(f"./output/{split_model}/{song_id}/vocal_{song_id}.wav_10.wav", sr=16000, mono=True)
|
485 |
-
song_infer = infer_gpu(hubert_model, net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
|
|
|
|
486 |
else:
|
487 |
print("2.1.开始去除BGM")
|
488 |
audio, sr = librosa.load(youtube_downloader(video_identifier, song_id, split_model)[0], sr=16000, mono=True)
|
489 |
print("2.2.开始推理")
|
490 |
-
song_infer = infer_gpu(hubert_model, net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
|
|
491 |
|
492 |
sf.write(song_name.strip()+zip_path+"AI翻唱.wav", song_infer, tgt_sr)
|
493 |
output_full_song = combine_vocal_and_inst(zip_path, song_name.strip(), song_id, split_model, song_name.strip()+zip_path+"AI翻唱.wav", vocal_volume, inst_volume)
|
|
|
428 |
singers="您的专属AI歌手阵容:"
|
429 |
|
430 |
@spaces.GPU(duration=80)
|
431 |
+
def infer_gpu(net_g, audio, f0_up_key, index_file, tgt_sr, version, f0_file=None):
|
432 |
from fairseq import checkpoint_utils
|
433 |
models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
|
434 |
["hubert_base.pt"],
|
|
|
482 |
if os.path.isdir(f"./output/{split_model}/{song_id}")==True:
|
483 |
print("2.直接开始推理")
|
484 |
audio, sr = librosa.load(f"./output/{split_model}/{song_id}/vocal_{song_id}.wav_10.wav", sr=16000, mono=True)
|
485 |
+
#song_infer = infer_gpu(hubert_model, net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
486 |
+
song_infer = infer_gpu(net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
487 |
+
|
488 |
else:
|
489 |
print("2.1.开始去除BGM")
|
490 |
audio, sr = librosa.load(youtube_downloader(video_identifier, song_id, split_model)[0], sr=16000, mono=True)
|
491 |
print("2.2.开始推理")
|
492 |
+
#song_infer = infer_gpu(hubert_model, net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
493 |
+
song_infer = infer_gpu(net_g, audio, f0_up_key, index_files[0], tgt_sr, version, f0_file=None)
|
494 |
|
495 |
sf.write(song_name.strip()+zip_path+"AI翻唱.wav", song_infer, tgt_sr)
|
496 |
output_full_song = combine_vocal_and_inst(zip_path, song_name.strip(), song_id, split_model, song_name.strip()+zip_path+"AI翻唱.wav", vocal_volume, inst_volume)
|