Spaces:
Running
Running
Update src/covergen.py
Browse files- src/covergen.py +58 -18
src/covergen.py
CHANGED
|
@@ -9,7 +9,8 @@ import gradio as gr
|
|
| 9 |
from main import song_cover_pipeline
|
| 10 |
from audio_effects import add_audio_effects
|
| 11 |
from modules.model_management import ignore_files, update_models_list, extract_zip, download_from_url, upload_zip_model
|
| 12 |
-
from modules.ui_updates import show_hop_slider, update_f0_method, update_button_text,
|
|
|
|
| 13 |
from modules.file_processing import process_file_upload
|
| 14 |
|
| 15 |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
@@ -57,11 +58,24 @@ if __name__ == '__main__':
|
|
| 57 |
pitch = gr.Slider(-24, 24, value=0, step=0.5, label='Pitch Adjustment', info='-24 - male voice || 24 - female voice')
|
| 58 |
|
| 59 |
with gr.Column(scale=2, variant='panel'):
|
| 60 |
-
with gr.
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
with gr.Group():
|
| 67 |
with gr.Row(variant='panel'):
|
|
@@ -85,24 +99,50 @@ if __name__ == '__main__':
|
|
| 85 |
|
| 86 |
ref_btn.click(update_models_list, None, outputs=rvc_model)
|
| 87 |
generate_btn.click(song_cover_pipeline,
|
| 88 |
-
inputs=[
|
| 89 |
outputs=[converted_voice])
|
| 90 |
|
| 91 |
with gr.Tab('Merge/Process'):
|
| 92 |
with gr.Row(equal_height=False):
|
| 93 |
with gr.Column(variant='panel'):
|
| 94 |
-
with gr.
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
with gr.Column(variant='panel'):
|
| 101 |
-
with gr.
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
with gr.Group():
|
| 108 |
with gr.Row(variant='panel'):
|
|
@@ -164,7 +204,7 @@ if __name__ == '__main__':
|
|
| 164 |
noise_gate_release = gr.Slider(0, 1000, value=100, label='Release Time (ms)', info='This parameter controls the speed at which the noise gate closes when the sound becomes quiet enough. A higher value means the gate closes slower.')
|
| 165 |
|
| 166 |
process_btn.click(add_audio_effects,
|
| 167 |
-
inputs=[
|
| 168 |
reverb_width, low_shelf_gain, high_shelf_gain, compressor_ratio, compressor_threshold,
|
| 169 |
noise_gate_threshold, noise_gate_ratio, noise_gate_attack, noise_gate_release,
|
| 170 |
chorus_rate_hz, chorus_depth, chorus_centre_delay_ms, chorus_feedback, chorus_mix,
|
|
|
|
| 9 |
from main import song_cover_pipeline
|
| 10 |
from audio_effects import add_audio_effects
|
| 11 |
from modules.model_management import ignore_files, update_models_list, extract_zip, download_from_url, upload_zip_model
|
| 12 |
+
from modules.ui_updates import (show_hop_slider, update_f0_method, update_button_text,
|
| 13 |
+
update_button_text_voc, update_button_text_inst, swap_visibility, swap_buttons)
|
| 14 |
from modules.file_processing import process_file_upload
|
| 15 |
|
| 16 |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
| 58 |
pitch = gr.Slider(-24, 24, value=0, step=0.5, label='Pitch Adjustment', info='-24 - male voice || 24 - female voice')
|
| 59 |
|
| 60 |
with gr.Column(scale=2, variant='panel'):
|
| 61 |
+
with gr.Column() as upload_file:
|
| 62 |
+
with gr.Group():
|
| 63 |
+
local_file = gr.Audio(label='Audio File', interactive=False, show_download_button=False, show_share_button=False)
|
| 64 |
+
uploaded_file = gr.UploadButton(label='Upload Audio File', file_types=['audio'], variant='primary')
|
| 65 |
+
|
| 66 |
+
with gr.Column(visible=False) as enter_local_file:
|
| 67 |
+
song_input = gr.Text(label='Local file path', info='Enter the full path to the local file.')
|
| 68 |
+
|
| 69 |
+
with gr.Column():
|
| 70 |
+
show_upload_button = gr.Button('Uploading a file from your device', visible=False)
|
| 71 |
+
show_enter_button = gr.Button('Entering the path to the local file')
|
| 72 |
+
|
| 73 |
+
uploaded_file.upload(process_file_upload, inputs=[uploaded_file], outputs=[song_input, local_file])
|
| 74 |
+
uploaded_file.upload(update_button_text, outputs=[uploaded_file])
|
| 75 |
+
show_upload_button.click(swap_visibility, outputs=[upload_file, enter_local_file, song_input, local_file])
|
| 76 |
+
show_enter_button.click(swap_visibility, outputs=[enter_local_file, upload_file, song_input, local_file])
|
| 77 |
+
show_upload_button.click(swap_buttons, outputs=[show_upload_button, show_enter_button])
|
| 78 |
+
show_enter_button.click(swap_buttons, outputs=[show_enter_button, show_upload_button])
|
| 79 |
|
| 80 |
with gr.Group():
|
| 81 |
with gr.Row(variant='panel'):
|
|
|
|
| 99 |
|
| 100 |
ref_btn.click(update_models_list, None, outputs=rvc_model)
|
| 101 |
generate_btn.click(song_cover_pipeline,
|
| 102 |
+
inputs=[song_input, rvc_model, pitch, index_rate, filter_radius, rms_mix_rate, f0_method, crepe_hop_length, protect, output_format],
|
| 103 |
outputs=[converted_voice])
|
| 104 |
|
| 105 |
with gr.Tab('Merge/Process'):
|
| 106 |
with gr.Row(equal_height=False):
|
| 107 |
with gr.Column(variant='panel'):
|
| 108 |
+
with gr.Column() as upload_voc_file:
|
| 109 |
+
with gr.Group():
|
| 110 |
+
vocal_audio = gr.Audio(label='Vocals', interactive=False, show_download_button=False, show_share_button=False)
|
| 111 |
+
upload_vocal_audio = gr.UploadButton(label='Upload Vocals', file_types=['audio'], variant='primary')
|
| 112 |
+
|
| 113 |
+
with gr.Column(visible=False) as enter_local_voc_file:
|
| 114 |
+
vocal_input = gr.Text(label='Vocal file path', info='Enter the full path to the local vocal file.')
|
| 115 |
+
|
| 116 |
+
with gr.Column():
|
| 117 |
+
show_upload_voc_button = gr.Button('Uploading a file from your device', visible=False)
|
| 118 |
+
show_enter_voc_button = gr.Button('Entering the path to the local file')
|
| 119 |
+
|
| 120 |
+
upload_vocal_audio.upload(process_file_upload, inputs=[upload_vocal_audio], outputs=[vocal_input, vocal_audio])
|
| 121 |
+
upload_vocal_audio.upload(update_button_text_voc, outputs=[upload_vocal_audio])
|
| 122 |
+
show_upload_voc_button.click(swap_visibility, outputs=[upload_voc_file, enter_local_voc_file, vocal_input, vocal_audio])
|
| 123 |
+
show_enter_voc_button.click(swap_visibility, outputs=[enter_local_voc_file, upload_voc_file, vocal_input, vocal_audio])
|
| 124 |
+
show_upload_voc_button.click(swap_buttons, outputs=[show_upload_voc_button, show_enter_voc_button])
|
| 125 |
+
show_enter_voc_button.click(swap_buttons, outputs=[show_enter_voc_button, show_upload_voc_button])
|
| 126 |
|
| 127 |
with gr.Column(variant='panel'):
|
| 128 |
+
with gr.Column() as upload_inst_file:
|
| 129 |
+
with gr.Group():
|
| 130 |
+
instrumental_audio = gr.Audio(label='Instrumental', interactive=False, show_download_button=False, show_share_button=False)
|
| 131 |
+
upload_instrumental_audio = gr.UploadButton(label='Upload Instrumental', file_types=['audio'], variant='primary')
|
| 132 |
+
|
| 133 |
+
with gr.Column(visible=False) as enter_local_inst_file:
|
| 134 |
+
instrumental_input = gr.Text(label='Instrumental file path', info='Enter the full path to the local instrumental file.')
|
| 135 |
+
|
| 136 |
+
with gr.Column():
|
| 137 |
+
show_upload_voc_button = gr.Button('Uploading a file from your device', visible=False)
|
| 138 |
+
show_enter_voc_button = gr.Button('Entering the path to the local file')
|
| 139 |
+
|
| 140 |
+
upload_instrumental_audio.upload(process_file_upload, inputs=[upload_instrumental_audio], outputs=[instrumental_audio])
|
| 141 |
+
upload_instrumental_audio.upload(update_button_text_inst, outputs=[upload_instrumental_audio])
|
| 142 |
+
show_upload_inst_button.click(swap_visibility, outputs=[upload_inst_file, enter_local_inst_file, vocal_input, vocal_audio])
|
| 143 |
+
show_enter_inst_button.click(swap_visibility, outputs=[enter_local_inst_file, upload_inst_file, vocal_input, vocal_audio])
|
| 144 |
+
show_upload_inst_button.click(swap_buttons, outputs=[show_upload_inst_button, show_enter_inst_button])
|
| 145 |
+
show_enter_inst_button.click(swap_buttons, outputs=[show_enter_inst_button, show_upload_inst_button])
|
| 146 |
|
| 147 |
with gr.Group():
|
| 148 |
with gr.Row(variant='panel'):
|
|
|
|
| 204 |
noise_gate_release = gr.Slider(0, 1000, value=100, label='Release Time (ms)', info='This parameter controls the speed at which the noise gate closes when the sound becomes quiet enough. A higher value means the gate closes slower.')
|
| 205 |
|
| 206 |
process_btn.click(add_audio_effects,
|
| 207 |
+
inputs=[vocal_input, instrumental_input, reverb_rm_size, reverb_wet, reverb_dry, reverb_damping,
|
| 208 |
reverb_width, low_shelf_gain, high_shelf_gain, compressor_ratio, compressor_threshold,
|
| 209 |
noise_gate_threshold, noise_gate_ratio, noise_gate_attack, noise_gate_release,
|
| 210 |
chorus_rate_hz, chorus_depth, chorus_centre_delay_ms, chorus_feedback, chorus_mix,
|