Update tabs/infer/infer.py
Browse files- tabs/infer/infer.py +16 -8
tabs/infer/infer.py
CHANGED
@@ -15,6 +15,8 @@ def get_current_models(models_dir):
|
|
15 |
logger.error(f"Error accessing models directory: {e}\n{format_exc()}")
|
16 |
raise gr.Error(f"Failed to list models. Check directory permissions: {e}")
|
17 |
|
|
|
|
|
18 |
|
19 |
|
20 |
def inference_tab(status_message, rvc_model):
|
@@ -44,13 +46,19 @@ def inference_tab(status_message, rvc_model):
|
|
44 |
|
45 |
with gr.Group():
|
46 |
with gr.Row(equal_height=True):
|
47 |
-
with gr.Column(
|
48 |
-
song_input = gr.
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
)
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
with gr.Accordion("RVC Settings", open=False):
|
55 |
with gr.Row(equal_height=True):
|
56 |
with gr.Column(variant="panel", scale=1):
|
@@ -87,7 +95,7 @@ def inference_tab(status_message, rvc_model):
|
|
87 |
inst_gain = gr.Slider(-20, 20, value=0, step=1, label="Instrumental Gain (dB)")
|
88 |
|
89 |
with gr.Row(equal_height=True):
|
90 |
-
keep_files = gr.Checkbox(label="Keep Intermediate Files", value=
|
91 |
vocal_only = gr.Checkbox(label="Vocal-Only Conversion", value=False)
|
92 |
|
93 |
with gr.Row(equal_height=True):
|
|
|
15 |
logger.error(f"Error accessing models directory: {e}\n{format_exc()}")
|
16 |
raise gr.Error(f"Failed to list models. Check directory permissions: {e}")
|
17 |
|
18 |
+
def swap_visibility():
|
19 |
+
return gr.update(visible=True), gr.update(visible=False), gr.update(value=''), gr.update(value=None)
|
20 |
|
21 |
|
22 |
def inference_tab(status_message, rvc_model):
|
|
|
46 |
|
47 |
with gr.Group():
|
48 |
with gr.Row(equal_height=True):
|
49 |
+
with gr.Column() as yt_link_col:
|
50 |
+
song_input = gr.Text(label='Song input', info='Link to a song on YouTube or full path to a local file. For file upload, click the button below.')
|
51 |
+
show_file_upload_button = gr.Button('Upload file instead?')
|
52 |
+
|
53 |
+
with gr.Column(visible=False) as file_upload_col:
|
54 |
+
local_file = gr.Audio(label='Audio file')
|
55 |
+
|
56 |
+
show_yt_link_button = gr.Button('Paste YouTube link instead?')
|
57 |
+
song_input_file.upload(process_file_upload, inputs=[song_input_file], outputs=[local_file, song_input])
|
58 |
+
|
59 |
+
show_file_upload_button.click(swap_visibility, outputs=[file_upload_col, yt_link_col, song_input, local_file])
|
60 |
+
show_yt_link_button.click(swap_visibility, outputs=[yt_link_col, file_upload_col, song_input, local_file])
|
61 |
+
|
62 |
with gr.Accordion("RVC Settings", open=False):
|
63 |
with gr.Row(equal_height=True):
|
64 |
with gr.Column(variant="panel", scale=1):
|
|
|
95 |
inst_gain = gr.Slider(-20, 20, value=0, step=1, label="Instrumental Gain (dB)")
|
96 |
|
97 |
with gr.Row(equal_height=True):
|
98 |
+
keep_files = gr.Checkbox(label="Keep Intermediate Files", value=False, visible=False)
|
99 |
vocal_only = gr.Checkbox(label="Vocal-Only Conversion", value=False)
|
100 |
|
101 |
with gr.Row(equal_height=True):
|