Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -98,30 +98,34 @@ def inference(audio_file: str, model_name: str, vocals: bool, drums: bool, bass:
|
|
98 |
|
99 |
return output_file, separation_log
|
100 |
|
101 |
-
#
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
-
#
|
123 |
-
# iface.inputs[-2].change(fn=lambda mp3: gr.update(visible=mp3), inputs=iface.inputs[-2], outputs=iface.inputs[-1])
|
124 |
-
iface.components[-2].change(fn=lambda mp3: gr.update(visible=mp3), inputs=iface.components[-2], outputs=iface.components[-1])
|
125 |
-
|
126 |
-
# launch the gradio interface
|
127 |
iface.launch()
|
|
|
98 |
|
99 |
return output_file, separation_log
|
100 |
|
101 |
+
# Define the Gradio interface
|
102 |
+
with gr.Blocks() as iface:
|
103 |
+
audio_input = gr.Audio(type="filepath")
|
104 |
+
model_dropdown = gr.Dropdown(["htdemucs", "htdemucs_ft", "htdemucs_6s", "hdemucs_mmi", "mdx", "mdx_extra", "mdx_q", "mdx_extra_q"], label="Model Name", value="htdemucs_ft")
|
105 |
+
vocals_checkbox = gr.Checkbox(label="Vocals", value=True)
|
106 |
+
drums_checkbox = gr.Checkbox(label="Drums", value=True)
|
107 |
+
bass_checkbox = gr.Checkbox(label="Bass", value=True)
|
108 |
+
other_checkbox = gr.Checkbox(label="Other", value=True)
|
109 |
+
mp3_checkbox = gr.Checkbox(label="Save as MP3", value=False)
|
110 |
+
mp3_bitrate = gr.Slider(128, 320, step=32, label="MP3 Bitrate", visible=False)
|
111 |
+
|
112 |
+
output_audio = gr.Audio(type="filepath")
|
113 |
+
separation_log = gr.Textbox(label="Separation Log", lines=10)
|
114 |
+
|
115 |
+
submit_btn = gr.Button("Process")
|
116 |
+
|
117 |
+
submit_btn.click(
|
118 |
+
fn=inference,
|
119 |
+
inputs=[audio_input, model_dropdown, vocals_checkbox, drums_checkbox, bass_checkbox, other_checkbox, mp3_checkbox, mp3_bitrate],
|
120 |
+
outputs=[output_audio, separation_log]
|
121 |
+
)
|
122 |
+
|
123 |
+
# Make MP3 bitrate slider visible only when "Save as MP3" is checked
|
124 |
+
mp3_checkbox.change(
|
125 |
+
fn=lambda mp3: gr.update(visible=mp3),
|
126 |
+
inputs=mp3_checkbox,
|
127 |
+
outputs=mp3_bitrate
|
128 |
+
)
|
129 |
|
130 |
+
# Launch the Gradio interface
|
|
|
|
|
|
|
|
|
131 |
iface.launch()
|