diff --git a/tabs/inference/inference.py b/tabs/inference/inference.py index 7e452dd4..42fec787 100644 --- a/tabs/inference/inference.py +++ b/tabs/inference/inference.py @@ -369,7 +369,6 @@ def inference_tab(): inputs=[], outputs=[model_file, index_file], ) - model_file.select( fn=lambda model_file_value: match_index(model_file_value), inputs=[model_file], @@ -538,7 +537,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_damping = gr.Slider( minimum=0, maximum=1, @@ -548,7 +546,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_wet_gain = gr.Slider( minimum=0, maximum=1, @@ -558,7 +555,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_dry_gain = gr.Slider( minimum=0, maximum=1, @@ -568,7 +564,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_width = gr.Slider( minimum=0, maximum=1, @@ -578,7 +573,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_freeze_mode = gr.Slider( minimum=0, maximum=1, @@ -620,7 +614,6 @@ def inference_tab(): interactive=True, visible=False, ) - limiter_release_time = gr.Slider( minimum=0.01, maximum=1, @@ -678,7 +671,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_depth = gr.Slider( minimum=0, maximum=1, @@ -688,7 +680,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_center_delay = gr.Slider( minimum=7, maximum=8, @@ -698,7 +689,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_feedback = gr.Slider( minimum=0, maximum=1, @@ -708,7 +698,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_mix = gr.Slider( minimum=0, maximum=1, @@ -766,7 +755,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_ratio = gr.Slider( minimum=1, maximum=20, @@ -776,7 +764,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_attack = gr.Slider( minimum=0.0, maximum=100, @@ -786,7 +773,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_release = gr.Slider( minimum=0.01, maximum=100, @@ -812,7 +798,6 @@ def inference_tab(): interactive=True, visible=False, ) - delay_feedback = gr.Slider( minimum=0.0, maximum=1.0, @@ -822,7 +807,6 @@ def inference_tab(): interactive=True, visible=False, ) - delay_mix = gr.Slider( minimum=0.0, maximum=1.0, @@ -1011,6 +995,29 @@ def inference_tab(): visible=True, ) + def enforce_terms(terms_accepted, *args): + if not terms_accepted: + message = "You must agree to the Terms of Use to proceed." + gr.Info(message) + return message, None + return run_infer_script(*args) + + def enforce_terms_batch(terms_accepted, *args): + if not terms_accepted: + message = "You must agree to the Terms of Use to proceed." + gr.Info(message) + return message, None + return run_batch_infer_script(*args) + + terms_checkbox = gr.Checkbox( + label=i18n("I agree to the terms of use"), + info=i18n( + "Please ensure compliance with the terms and conditions detailed in [this document](https://github.com/IAHispano/Applio/blob/main/TERMS_OF_USE.md) before proceeding with your inference." + ), + value=False, + interactive=True, + ) + convert_button1 = gr.Button(i18n("Convert")) with gr.Row(): @@ -1173,7 +1180,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_damping_batch = gr.Slider( minimum=0, maximum=1, @@ -1183,7 +1189,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_wet_gain_batch = gr.Slider( minimum=0, maximum=1, @@ -1193,7 +1198,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_dry_gain_batch = gr.Slider( minimum=0, maximum=1, @@ -1203,7 +1207,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_width_batch = gr.Slider( minimum=0, maximum=1, @@ -1213,7 +1216,6 @@ def inference_tab(): interactive=True, visible=False, ) - reverb_freeze_mode_batch = gr.Slider( minimum=0, maximum=1, @@ -1255,7 +1257,6 @@ def inference_tab(): interactive=True, visible=False, ) - limiter_release_time_batch = gr.Slider( minimum=0.01, maximum=1, @@ -1313,7 +1314,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_depth_batch = gr.Slider( minimum=0, maximum=1, @@ -1323,7 +1323,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_center_delay_batch = gr.Slider( minimum=7, maximum=8, @@ -1333,7 +1332,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_feedback_batch = gr.Slider( minimum=0, maximum=1, @@ -1343,7 +1341,6 @@ def inference_tab(): interactive=True, visible=False, ) - chorus_mix_batch = gr.Slider( minimum=0, maximum=1, @@ -1401,7 +1398,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_ratio_batch = gr.Slider( minimum=1, maximum=20, @@ -1411,7 +1407,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_attack_batch = gr.Slider( minimum=0.0, maximum=100, @@ -1421,7 +1416,6 @@ def inference_tab(): interactive=True, visible=False, ) - compressor_release_batch = gr.Slider( minimum=0.01, maximum=100, @@ -1447,7 +1441,6 @@ def inference_tab(): interactive=True, visible=False, ) - delay_feedback_batch = gr.Slider( minimum=0.0, maximum=1.0, @@ -1457,7 +1450,6 @@ def inference_tab(): interactive=True, visible=False, ) - delay_mix_batch = gr.Slider( minimum=0.0, maximum=1.0, @@ -1647,7 +1639,15 @@ def inference_tab(): i18n("Move files to custom embedder folder") ) - convert_button2 = gr.Button(i18n("Convert")) + terms_checkbox_batch = gr.Checkbox( + label=i18n("I agree to the terms of use"), + info=i18n( + "Please ensure compliance with the terms and conditions detailed in [this document](https://github.com/IAHispano/Applio/blob/main/TERMS_OF_USE.md) before proceeding with your inference." + ), + value=False, + interactive=True, + ) + convert_button_batch = gr.Button(i18n("Convert")) stop_button = gr.Button(i18n("Stop convert"), visible=False) stop_button.click(fn=stop_infer, inputs=[], outputs=[]) @@ -1793,7 +1793,6 @@ def delay_visible(checkbox): delay, ], ) - reverb.change( fn=reverb_visible, inputs=[reverb], @@ -1878,7 +1877,6 @@ def delay_visible(checkbox): delay_batch, ], ) - reverb_batch.change( fn=reverb_visible, inputs=[reverb_batch], @@ -2032,8 +2030,9 @@ def delay_visible(checkbox): outputs=[embedder_model_custom_batch], ) convert_button1.click( - fn=run_infer_script, + fn=enforce_terms, inputs=[ + terms_checkbox, pitch, filter_radius, index_rate, @@ -2097,9 +2096,10 @@ def delay_visible(checkbox): ], outputs=[vc_output1, vc_output2], ) - convert_button2.click( - fn=run_batch_infer_script, + convert_button_batch.click( + fn=enforce_terms_batch, inputs=[ + terms_checkbox_batch, pitch_batch, filter_radius_batch, index_rate_batch, @@ -2163,13 +2163,13 @@ def delay_visible(checkbox): ], outputs=[vc_output3], ) - convert_button2.click( + convert_button_batch.click( fn=enable_stop_convert_button, inputs=[], - outputs=[convert_button2, stop_button], + outputs=[convert_button_batch, stop_button], ) stop_button.click( fn=disable_stop_convert_button, inputs=[], - outputs=[convert_button2, stop_button], + outputs=[convert_button_batch, stop_button], ) diff --git a/tabs/train/train.py b/tabs/train/train.py index 23c07dba..1f5b0d26 100644 --- a/tabs/train/train.py +++ b/tabs/train/train.py @@ -732,8 +732,23 @@ def train_tab(): interactive=True, ) - with gr.Row(): - train_output_info = gr.Textbox( + def enforce_terms(terms_accepted, *args): + if not terms_accepted: + message = "You must agree to the Terms of Use to proceed." + gr.Info(message) + return message + return run_train_script(*args) + + + terms_checkbox = gr.Checkbox( + label=i18n("I agree to the terms of use"), + info=i18n( + "Please ensure compliance with the terms and conditions detailed in [this document](https://github.com/IAHispano/Applio/blob/main/TERMS_OF_USE.md) before proceeding with your training." + ), + value=False, + interactive=True, + ) + train_output_info = gr.Textbox( label=i18n("Output Information"), info=i18n("The output information will be displayed here."), value="", @@ -744,8 +759,9 @@ def train_tab(): with gr.Row(): train_button = gr.Button(i18n("Start Training")) train_button.click( - fn=run_train_script, + fn=enforce_terms, inputs=[ + terms_checkbox, model_name, rvc_version, save_every_epoch, @@ -937,25 +953,21 @@ def update_slider_visibility(noise_reduction): inputs=[rvc_version, pitch_guidance], outputs=[], ) - pitch_guidance.change( fn=download_prerequisites, inputs=[rvc_version, pitch_guidance], outputs=[], ) - refresh.click( fn=refresh_models_and_datasets, inputs=[], outputs=[model_name, dataset_path], ) - dataset_creator.change( fn=toggle_visible, inputs=[dataset_creator], outputs=[dataset_creator_settings], ) - upload_audio_dataset.upload( fn=save_drop_dataset_audio, inputs=[upload_audio_dataset, dataset_name], @@ -991,61 +1003,51 @@ def update_slider_visibility(noise_reduction): inputs=[pretrained, custom_pretrained], outputs=[custom_pretrained, pretrained_custom_settings], ) - custom_pretrained.change( fn=toggle_visible, inputs=[custom_pretrained], outputs=[pretrained_custom_settings], ) - refresh_custom_pretaineds_button.click( fn=refresh_custom_pretraineds, inputs=[], outputs=[g_pretrained_path, d_pretrained_path], ) - upload_pretrained.upload( fn=save_drop_model, inputs=[upload_pretrained], outputs=[upload_pretrained], ) - overtraining_detector.change( fn=toggle_visible, inputs=[overtraining_detector], outputs=[overtraining_settings], ) - multiple_gpu.change( fn=toggle_visible, inputs=[multiple_gpu], outputs=[gpu_custom_settings], ) - train_button.click( fn=enable_stop_train_button, inputs=[], outputs=[train_button, stop_train_button], ) - train_output_info.change( fn=disable_stop_train_button, inputs=[], outputs=[train_button, stop_train_button], ) - pth_dropdown_export.change( fn=export_pth, inputs=[pth_dropdown_export], outputs=[pth_file_export], ) - index_dropdown_export.change( fn=export_index, inputs=[index_dropdown_export], outputs=[index_file_export], ) - refresh_export.click( fn=refresh_pth_and_index_list, inputs=[], diff --git a/tabs/tts/tts.py b/tabs/tts/tts.py index 2089016d..bf3f78c6 100644 --- a/tabs/tts/tts.py +++ b/tabs/tts/tts.py @@ -93,7 +93,7 @@ def tts_tab(): info=i18n("Select the TTS voice to use for the conversion."), choices=short_names, interactive=True, - value=None, + value=random.choice(short_names), ) tts_rate = gr.Slider( @@ -330,6 +330,21 @@ def tts_tab(): visible=True, ) + def enforce_terms(terms_accepted, *args): + if not terms_accepted: + message = "You must agree to the Terms of Use to proceed." + gr.Info(message) + return message, None + return run_tts_script(*args) + + terms_checkbox = gr.Checkbox( + label=i18n("I agree to the terms of use"), + info=i18n( + "Please ensure compliance with the terms and conditions detailed in [this document](https://github.com/IAHispano/Applio/blob/main/TERMS_OF_USE.md) before proceeding with your inference." + ), + value=False, + interactive=True, + ) convert_button = gr.Button(i18n("Convert")) with gr.Row(): @@ -383,8 +398,9 @@ def toggle_visible_embedder_custom(embedder_model): outputs=[embedder_model_custom], ) convert_button.click( - fn=run_tts_script, + fn=enforce_terms, inputs=[ + terms_checkbox, input_tts_path, tts_text, tts_voice,