Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -631,6 +631,15 @@ def analyze_and_separate(file_input, url_input, stem_mode, manual_bpm):
|
|
| 631 |
|
| 632 |
stems = map_stems(track_folder, stem_mode)
|
| 633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
p_drums = str(stems["Drums"]) if "Drums" in stems and stems["Drums"].exists() else None
|
| 635 |
p_bass = str(stems["Bass"]) if "Bass" in stems and stems["Bass"].exists() else None
|
| 636 |
p_guitar = str(stems["Guitar"]) if "Guitar" in stems and stems["Guitar"].exists() else None
|
|
@@ -645,7 +654,11 @@ def analyze_and_separate(file_input, url_input, stem_mode, manual_bpm):
|
|
| 645 |
|
| 646 |
p_vocals = str(stems["Vocals"]) if "Vocals" in stems and stems["Vocals"].exists() else None
|
| 647 |
|
| 648 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 649 |
|
| 650 |
except Exception as e:
|
| 651 |
raise gr.Error(f"Process Failed: {str(e)}")
|
|
@@ -1010,7 +1023,11 @@ with gr.Blocks(title="Night Pulse | Studio Pro") as app:
|
|
| 1010 |
btn_analyze.click(
|
| 1011 |
fn=analyze_and_separate,
|
| 1012 |
inputs=[input_file, input_url, stem_mode, manual_bpm],
|
| 1013 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1014 |
)
|
| 1015 |
|
| 1016 |
btn_package.click(
|
|
|
|
| 631 |
|
| 632 |
stems = map_stems(track_folder, stem_mode)
|
| 633 |
|
| 634 |
+
# --- UPDATE UI CHECKBOXES DYNAMICALLY ---
|
| 635 |
+
available_stems = list(stems.keys())
|
| 636 |
+
# Default checked = all stems for export
|
| 637 |
+
new_export_stems = gr.CheckboxGroup(choices=available_stems, value=available_stems)
|
| 638 |
+
# Default checked = all except vocals for loops
|
| 639 |
+
loop_defaults = [s for s in available_stems if s != "Vocals"]
|
| 640 |
+
new_loop_stems = gr.CheckboxGroup(choices=available_stems, value=loop_defaults)
|
| 641 |
+
# ----------------------------------------
|
| 642 |
+
|
| 643 |
p_drums = str(stems["Drums"]) if "Drums" in stems and stems["Drums"].exists() else None
|
| 644 |
p_bass = str(stems["Bass"]) if "Bass" in stems and stems["Bass"].exists() else None
|
| 645 |
p_guitar = str(stems["Guitar"]) if "Guitar" in stems and stems["Guitar"].exists() else None
|
|
|
|
| 654 |
|
| 655 |
p_vocals = str(stems["Vocals"]) if "Vocals" in stems and stems["Vocals"].exists() else None
|
| 656 |
|
| 657 |
+
return (
|
| 658 |
+
p_drums, p_bass, p_guitar, p_piano, p_other, p_vocals,
|
| 659 |
+
bpm, str(track_folder), stem_mode,
|
| 660 |
+
new_export_stems, new_loop_stems # Return the dynamic updates
|
| 661 |
+
)
|
| 662 |
|
| 663 |
except Exception as e:
|
| 664 |
raise gr.Error(f"Process Failed: {str(e)}")
|
|
|
|
| 1023 |
btn_analyze.click(
|
| 1024 |
fn=analyze_and_separate,
|
| 1025 |
inputs=[input_file, input_url, stem_mode, manual_bpm],
|
| 1026 |
+
outputs=[
|
| 1027 |
+
p_drums, p_bass, p_guitar, p_piano, p_other, p_vocals,
|
| 1028 |
+
stored_bpm, stored_folder, stored_mode,
|
| 1029 |
+
export_stems, loop_stems # Targeted updates for checkboxes
|
| 1030 |
+
],
|
| 1031 |
)
|
| 1032 |
|
| 1033 |
btn_package.click(
|