Spaces:
Running
Running
New param f0_min, f0_max + model installation by files
Browse files- src/covergen.py +28 -15
src/covergen.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
import os, sys
|
| 2 |
-
import json
|
| 3 |
import shutil
|
| 4 |
import urllib.request
|
| 5 |
import zipfile
|
|
@@ -8,9 +7,8 @@ import gradio as gr
|
|
| 8 |
|
| 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
|
| 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__)))
|
|
@@ -29,21 +27,18 @@ elif warning == 'False':
|
|
| 29 |
if __name__ == '__main__':
|
| 30 |
voice_models = ignore_files(rvc_models_dir)
|
| 31 |
|
| 32 |
-
with gr.Blocks(title='CoverGen Lite - Politrees
|
| 33 |
|
| 34 |
if warning:
|
| 35 |
with gr.Column(variant='panel'):
|
| 36 |
gr.HTML("<center><h2>This space is running too slow due to a weak server, so I made a Google Colab notebook to work faster with this interface: <a href='https://colab.research.google.com/drive/1HzuPgICRrjqUWQWb5Zn-l07m099-n-Nr'>Google Colab Notebook</a>.</h2></center>")
|
| 37 |
|
| 38 |
with gr.Tab("Welcome/Contacts"):
|
| 39 |
-
gr.HTML("<center><h1>Welcome to CoverGen Lite - Politrees
|
| 40 |
-
with gr.
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
with gr.Column(variant='panel'):
|
| 45 |
-
gr.HTML("<center><h2><a href='https://t.me/pol1trees'>Telegram Channel</a></h2></center>")
|
| 46 |
-
gr.HTML("<center><h2><a href='https://t.me/+GMTP7hZqY0E4OGRi'>Telegram Chat</a></h2></center>")
|
| 47 |
with gr.Column(variant='panel'):
|
| 48 |
gr.HTML("<center><h2><a href='https://www.youtube.com/channel/UCHb3fZEVxUisnqLqCrEM8ZA'>YouTube</a></h2></center>")
|
| 49 |
gr.HTML("<center><h2><a href='https://github.com/Bebra777228'>GitHub</a></h2></center>")
|
|
@@ -91,6 +86,9 @@ if __name__ == '__main__':
|
|
| 91 |
use_hybrid_methods.change(update_f0_method, inputs=use_hybrid_methods, outputs=f0_method)
|
| 92 |
crepe_hop_length = gr.Slider(8, 512, value=128, step=8, visible=False, label='Crepe Hop Length')
|
| 93 |
f0_method.change(show_hop_slider, inputs=f0_method, outputs=crepe_hop_length)
|
|
|
|
|
|
|
|
|
|
| 94 |
with gr.Column(variant='panel'):
|
| 95 |
index_rate = gr.Slider(0, 1, value=0, label='Index Rate', info='Controls the extent to which the index file influences the analysis results. A higher value increases the influence of the index file, but may amplify breathing artifacts in the audio. Choosing a lower value may help reduce artifacts.')
|
| 96 |
filter_radius = gr.Slider(0, 7, value=3, step=1, label='Filter Radius', info='Manages the radius of filtering the pitch analysis results. If the filtering value is three or higher, median filtering is applied to reduce breathing noise in the audio recording.')
|
|
@@ -222,17 +220,19 @@ if __name__ == '__main__':
|
|
| 222 |
with gr.Tab('Download from Link'):
|
| 223 |
with gr.Row():
|
| 224 |
with gr.Column(variant='panel'):
|
| 225 |
-
gr.HTML("<center><h3>
|
| 226 |
model_zip_link = gr.Text(label='Model Download Link')
|
| 227 |
with gr.Column(variant='panel'):
|
| 228 |
with gr.Group():
|
| 229 |
model_name = gr.Text(label='Model Name', info='Give your uploaded model a unique name, different from other voice models.')
|
| 230 |
download_btn = gr.Button('Download Model', variant='primary')
|
| 231 |
|
|
|
|
|
|
|
| 232 |
dl_output_message = gr.Text(label='Output Message', interactive=False)
|
| 233 |
download_btn.click(download_from_url, inputs=[model_zip_link, model_name], outputs=dl_output_message)
|
| 234 |
|
| 235 |
-
with gr.Tab('Upload
|
| 236 |
with gr.Row(equal_height=False):
|
| 237 |
with gr.Column(variant='panel'):
|
| 238 |
zip_file = gr.File(label='Zip File', file_types=['.zip'], file_count='single')
|
|
@@ -247,4 +247,17 @@ if __name__ == '__main__':
|
|
| 247 |
local_upload_output_message = gr.Text(label='Output Message', interactive=False)
|
| 248 |
model_upload_button.click(upload_zip_model, inputs=[zip_file, local_model_name], outputs=local_upload_output_message)
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
app.launch(share=True, show_api=False).queue(api_open=False)
|
|
|
|
| 1 |
import os, sys
|
|
|
|
| 2 |
import shutil
|
| 3 |
import urllib.request
|
| 4 |
import zipfile
|
|
|
|
| 7 |
|
| 8 |
from main import song_cover_pipeline
|
| 9 |
from audio_effects import add_audio_effects
|
| 10 |
+
from modules.model_management import ignore_files, update_models_list, extract_zip, download_from_url, upload_zip_model, upload_separate_files
|
| 11 |
+
from modules.ui_updates import show_hop_slider, update_f0_method, update_button_text, update_button_text_voc, update_button_text_inst, swap_visibility, swap_buttons
|
|
|
|
| 12 |
from modules.file_processing import process_file_upload
|
| 13 |
|
| 14 |
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
| 27 |
if __name__ == '__main__':
|
| 28 |
voice_models = ignore_files(rvc_models_dir)
|
| 29 |
|
| 30 |
+
with gr.Blocks(title='CoverGen Lite - Politrees', theme=gr.themes.Soft(primary_hue="green", secondary_hue="green", neutral_hue="neutral", spacing_size="sm", radius_size="lg")) as app:
|
| 31 |
|
| 32 |
if warning:
|
| 33 |
with gr.Column(variant='panel'):
|
| 34 |
gr.HTML("<center><h2>This space is running too slow due to a weak server, so I made a Google Colab notebook to work faster with this interface: <a href='https://colab.research.google.com/drive/1HzuPgICRrjqUWQWb5Zn-l07m099-n-Nr'>Google Colab Notebook</a>.</h2></center>")
|
| 35 |
|
| 36 |
with gr.Tab("Welcome/Contacts"):
|
| 37 |
+
gr.HTML("<center><h1>Welcome to CoverGen Lite - Politrees</h1></center>")
|
| 38 |
+
with gr.Column(variant='panel'):
|
| 39 |
+
gr.HTML("<center><h2><a href='https://t.me/Politrees2'>Telegram</a></h2></center>")
|
| 40 |
+
gr.HTML("<center><h2><a href='https://t.me/pol1trees'>Telegram Channel</a></h2></center>")
|
| 41 |
+
gr.HTML("<center><h2><a href='https://t.me/+GMTP7hZqY0E4OGRi'>Telegram Chat</a></h2></center>")
|
|
|
|
|
|
|
|
|
|
| 42 |
with gr.Column(variant='panel'):
|
| 43 |
gr.HTML("<center><h2><a href='https://www.youtube.com/channel/UCHb3fZEVxUisnqLqCrEM8ZA'>YouTube</a></h2></center>")
|
| 44 |
gr.HTML("<center><h2><a href='https://github.com/Bebra777228'>GitHub</a></h2></center>")
|
|
|
|
| 86 |
use_hybrid_methods.change(update_f0_method, inputs=use_hybrid_methods, outputs=f0_method)
|
| 87 |
crepe_hop_length = gr.Slider(8, 512, value=128, step=8, visible=False, label='Crepe Hop Length')
|
| 88 |
f0_method.change(show_hop_slider, inputs=f0_method, outputs=crepe_hop_length)
|
| 89 |
+
with gr.Row():
|
| 90 |
+
f0_min = gr.Slider(label="Minimum pitch range", info="Defines the lower limit of the pitch range that the algorithm will use to determine the fundamental frequency (F0) in the audio signal.", step=1, minimum=1, value=50, maximum=120)
|
| 91 |
+
f0_max = gr.Slider(label="Maximum pitch range", info="Defines the upper limit of the pitch range that the algorithm will use to determine the fundamental frequency (F0) in the audio signal.", step=1, minimum=380, value=1100, maximum=16000)
|
| 92 |
with gr.Column(variant='panel'):
|
| 93 |
index_rate = gr.Slider(0, 1, value=0, label='Index Rate', info='Controls the extent to which the index file influences the analysis results. A higher value increases the influence of the index file, but may amplify breathing artifacts in the audio. Choosing a lower value may help reduce artifacts.')
|
| 94 |
filter_radius = gr.Slider(0, 7, value=3, step=1, label='Filter Radius', info='Manages the radius of filtering the pitch analysis results. If the filtering value is three or higher, median filtering is applied to reduce breathing noise in the audio recording.')
|
|
|
|
| 220 |
with gr.Tab('Download from Link'):
|
| 221 |
with gr.Row():
|
| 222 |
with gr.Column(variant='panel'):
|
| 223 |
+
gr.HTML("<center><h3>Enter a link to the ZIP archive in the field below.</h3></center>")
|
| 224 |
model_zip_link = gr.Text(label='Model Download Link')
|
| 225 |
with gr.Column(variant='panel'):
|
| 226 |
with gr.Group():
|
| 227 |
model_name = gr.Text(label='Model Name', info='Give your uploaded model a unique name, different from other voice models.')
|
| 228 |
download_btn = gr.Button('Download Model', variant='primary')
|
| 229 |
|
| 230 |
+
gr.HTML("<h3>Supported sites: <a href='https://huggingface.co/' target='_blank'>HuggingFace</a>, <a href='https://pixeldrain.com/' target='_blank'>Pixeldrain</a>, <a href='https://drive.google.com/' target='_blank'>Google Drive</a>, <a href='https://mega.nz/' target='_blank'>Mega</a>, <a href='https://disk.yandex.ru/' target='_blank'>Yandex Disk</a></h3>")
|
| 231 |
+
|
| 232 |
dl_output_message = gr.Text(label='Output Message', interactive=False)
|
| 233 |
download_btn.click(download_from_url, inputs=[model_zip_link, model_name], outputs=dl_output_message)
|
| 234 |
|
| 235 |
+
with gr.Tab('Upload a ZIP archive'):
|
| 236 |
with gr.Row(equal_height=False):
|
| 237 |
with gr.Column(variant='panel'):
|
| 238 |
zip_file = gr.File(label='Zip File', file_types=['.zip'], file_count='single')
|
|
|
|
| 247 |
local_upload_output_message = gr.Text(label='Output Message', interactive=False)
|
| 248 |
model_upload_button.click(upload_zip_model, inputs=[zip_file, local_model_name], outputs=local_upload_output_message)
|
| 249 |
|
| 250 |
+
with gr.Tab('Upload files'):
|
| 251 |
+
with gr.Group():
|
| 252 |
+
with gr.Row():
|
| 253 |
+
pth_file = gr.File(label='.pth file', file_types=['.pth'], file_count='single')
|
| 254 |
+
index_file = gr.File(label='.index file', file_types=['.index'], file_count='single')
|
| 255 |
+
with gr.Column(variant='panel'):
|
| 256 |
+
with gr.Group():
|
| 257 |
+
separate_model_name = gr.Text(label='Model Name', info='Give your uploaded model a unique name, different from other voice models.')
|
| 258 |
+
separate_upload_button = gr.Button('Upload Model', variant='primary')
|
| 259 |
+
|
| 260 |
+
separate_upload_output_message = gr.Text(label='Output Message', interactive=False)
|
| 261 |
+
separate_upload_button.click(upload_separate_files, inputs=[pth_file, index_file, separate_model_name], outputs=separate_upload_output_message)
|
| 262 |
+
|
| 263 |
app.launch(share=True, show_api=False).queue(api_open=False)
|