Spaces:
Running
Running
Update src/main.py
Browse files- src/main.py +4 -4
src/main.py
CHANGED
@@ -43,7 +43,7 @@ def get_hash(filepath):
|
|
43 |
def display_progress(percent, message, progress=gr.Progress()):
|
44 |
progress(percent, desc=message)
|
45 |
|
46 |
-
def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length):
|
47 |
rvc_model_path, rvc_index_path = get_rvc_model(voice_model)
|
48 |
|
49 |
if torch.cuda.is_available():
|
@@ -56,14 +56,14 @@ def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method,
|
|
56 |
cpt, version, net_g, tgt_sr, vc = get_vc(device, config.is_half, config, rvc_model_path)
|
57 |
|
58 |
rvc_infer(rvc_index_path, index_rate, vocals_path, output_path, pitch_change, f0_method, cpt, version, net_g,
|
59 |
-
filter_radius, tgt_sr, rms_mix_rate, protect, crepe_hop_length, vc, hubert_model)
|
60 |
|
61 |
del hubert_model, cpt, net_g, vc
|
62 |
gc.collect()
|
63 |
torch.cuda.empty_cache()
|
64 |
|
65 |
def song_cover_pipeline(uploaded_file, voice_model, pitch_change, index_rate=0.5, filter_radius=3, rms_mix_rate=0.25, f0_method='rmvpe',
|
66 |
-
crepe_hop_length=128, protect=0.33, output_format='mp3', progress=gr.Progress()):
|
67 |
|
68 |
if not uploaded_file or not voice_model:
|
69 |
raise ValueError('Make sure that the song input field and voice model field are filled in.')
|
@@ -85,6 +85,6 @@ def song_cover_pipeline(uploaded_file, voice_model, pitch_change, index_rate=0.5
|
|
85 |
|
86 |
display_progress(0.5, '[~] Converting vocals...', progress)
|
87 |
voice_change(voice_model, orig_song_path, ai_cover_path, pitch_change, f0_method, index_rate,
|
88 |
-
filter_radius, rms_mix_rate, protect, crepe_hop_length)
|
89 |
|
90 |
return ai_cover_path
|
|
|
43 |
def display_progress(percent, message, progress=gr.Progress()):
|
44 |
progress(percent, desc=message)
|
45 |
|
46 |
+
def voice_change(voice_model, vocals_path, output_path, pitch_change, f0_method, index_rate, filter_radius, rms_mix_rate, protect, crepe_hop_length, f0_min, f0_max):
|
47 |
rvc_model_path, rvc_index_path = get_rvc_model(voice_model)
|
48 |
|
49 |
if torch.cuda.is_available():
|
|
|
56 |
cpt, version, net_g, tgt_sr, vc = get_vc(device, config.is_half, config, rvc_model_path)
|
57 |
|
58 |
rvc_infer(rvc_index_path, index_rate, vocals_path, output_path, pitch_change, f0_method, cpt, version, net_g,
|
59 |
+
filter_radius, tgt_sr, rms_mix_rate, protect, crepe_hop_length, vc, hubert_model, f0_min, f0_max)
|
60 |
|
61 |
del hubert_model, cpt, net_g, vc
|
62 |
gc.collect()
|
63 |
torch.cuda.empty_cache()
|
64 |
|
65 |
def song_cover_pipeline(uploaded_file, voice_model, pitch_change, index_rate=0.5, filter_radius=3, rms_mix_rate=0.25, f0_method='rmvpe',
|
66 |
+
crepe_hop_length=128, protect=0.33, output_format='mp3', progress=gr.Progress(), f0_min=50, f0_max=1100):
|
67 |
|
68 |
if not uploaded_file or not voice_model:
|
69 |
raise ValueError('Make sure that the song input field and voice model field are filled in.')
|
|
|
85 |
|
86 |
display_progress(0.5, '[~] Converting vocals...', progress)
|
87 |
voice_change(voice_model, orig_song_path, ai_cover_path, pitch_change, f0_method, index_rate,
|
88 |
+
filter_radius, rms_mix_rate, protect, crepe_hop_length, f0_min, f0_max)
|
89 |
|
90 |
return ai_cover_path
|