Skip to content

Commit

Permalink
Minor changes to infer & TTS, add TOS agreement to run tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisewf committed Dec 11, 2024
1 parent 8aa654a commit 0dabada
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 59 deletions.
80 changes: 40 additions & 40 deletions tabs/inference/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -538,7 +537,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_damping = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -548,7 +546,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_wet_gain = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -558,7 +555,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_dry_gain = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -568,7 +564,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_width = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -578,7 +573,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_freeze_mode = gr.Slider(
minimum=0,
maximum=1,
Expand Down Expand Up @@ -620,7 +614,6 @@ def inference_tab():
interactive=True,
visible=False,
)

limiter_release_time = gr.Slider(
minimum=0.01,
maximum=1,
Expand Down Expand Up @@ -678,7 +671,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_depth = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -688,7 +680,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_center_delay = gr.Slider(
minimum=7,
maximum=8,
Expand All @@ -698,7 +689,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_feedback = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -708,7 +698,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_mix = gr.Slider(
minimum=0,
maximum=1,
Expand Down Expand Up @@ -766,7 +755,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_ratio = gr.Slider(
minimum=1,
maximum=20,
Expand All @@ -776,7 +764,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_attack = gr.Slider(
minimum=0.0,
maximum=100,
Expand All @@ -786,7 +773,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_release = gr.Slider(
minimum=0.01,
maximum=100,
Expand All @@ -812,7 +798,6 @@ def inference_tab():
interactive=True,
visible=False,
)

delay_feedback = gr.Slider(
minimum=0.0,
maximum=1.0,
Expand All @@ -822,7 +807,6 @@ def inference_tab():
interactive=True,
visible=False,
)

delay_mix = gr.Slider(
minimum=0.0,
maximum=1.0,
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -1173,7 +1180,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_damping_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1183,7 +1189,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_wet_gain_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1193,7 +1198,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_dry_gain_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1203,7 +1207,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_width_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1213,7 +1216,6 @@ def inference_tab():
interactive=True,
visible=False,
)

reverb_freeze_mode_batch = gr.Slider(
minimum=0,
maximum=1,
Expand Down Expand Up @@ -1255,7 +1257,6 @@ def inference_tab():
interactive=True,
visible=False,
)

limiter_release_time_batch = gr.Slider(
minimum=0.01,
maximum=1,
Expand Down Expand Up @@ -1313,7 +1314,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_depth_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1323,7 +1323,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_center_delay_batch = gr.Slider(
minimum=7,
maximum=8,
Expand All @@ -1333,7 +1332,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_feedback_batch = gr.Slider(
minimum=0,
maximum=1,
Expand All @@ -1343,7 +1341,6 @@ def inference_tab():
interactive=True,
visible=False,
)

chorus_mix_batch = gr.Slider(
minimum=0,
maximum=1,
Expand Down Expand Up @@ -1401,7 +1398,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_ratio_batch = gr.Slider(
minimum=1,
maximum=20,
Expand All @@ -1411,7 +1407,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_attack_batch = gr.Slider(
minimum=0.0,
maximum=100,
Expand All @@ -1421,7 +1416,6 @@ def inference_tab():
interactive=True,
visible=False,
)

compressor_release_batch = gr.Slider(
minimum=0.01,
maximum=100,
Expand All @@ -1447,7 +1441,6 @@ def inference_tab():
interactive=True,
visible=False,
)

delay_feedback_batch = gr.Slider(
minimum=0.0,
maximum=1.0,
Expand All @@ -1457,7 +1450,6 @@ def inference_tab():
interactive=True,
visible=False,
)

delay_mix_batch = gr.Slider(
minimum=0.0,
maximum=1.0,
Expand Down Expand Up @@ -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=[])

Expand Down Expand Up @@ -1793,7 +1793,6 @@ def delay_visible(checkbox):
delay,
],
)

reverb.change(
fn=reverb_visible,
inputs=[reverb],
Expand Down Expand Up @@ -1878,7 +1877,6 @@ def delay_visible(checkbox):
delay_batch,
],
)

reverb_batch.change(
fn=reverb_visible,
inputs=[reverb_batch],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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],
)
Loading

0 comments on commit 0dabada

Please sign in to comment.