Spaces:
Running
Running
compact UI: remove instrumental checkbox, lock steps, scroll fix, timing labels, LoRA+LM same row
Browse files
app.py
CHANGED
|
@@ -506,7 +506,7 @@ def gradio_main():
|
|
| 506 |
_train_log_lines = []
|
| 507 |
|
| 508 |
# -- Generate tab handler --
|
| 509 |
-
def generate_music(caption, lyrics,
|
| 510 |
steps, lora_select, lm_model_select,
|
| 511 |
progress=gr.Progress(track_tqdm=True)):
|
| 512 |
if not _training_lock.acquire(blocking=False):
|
|
@@ -515,7 +515,7 @@ def gradio_main():
|
|
| 515 |
if not _server_ok():
|
| 516 |
return None, "ace-server not running. Check logs."
|
| 517 |
|
| 518 |
-
if
|
| 519 |
lyrics = "[Instrumental]"
|
| 520 |
|
| 521 |
actual_seed = None if seed is None or int(seed) < 0 else int(seed)
|
|
@@ -946,7 +946,7 @@ def gradio_main():
|
|
| 946 |
# -- Build UI --
|
| 947 |
CSS = """
|
| 948 |
.compact-row { gap: 8px !important; }
|
| 949 |
-
.status-box textarea { font-family: monospace; font-size: 13px; }
|
| 950 |
"""
|
| 951 |
|
| 952 |
with gr.Blocks(title="ACE-Step 1.5 XL (CPU)") as demo:
|
|
@@ -956,14 +956,14 @@ def gradio_main():
|
|
| 956 |
# Tab 1: Generate Music
|
| 957 |
# ============================================================
|
| 958 |
with gr.Tab("Generate Music"):
|
| 959 |
-
gr.Markdown("**[ACE-Step 1.5 XL](https://github.com/ace-step/ACE-Step-1.5)** GGUF Q4_K_M via [acestep.cpp](https://github.com/ServeurpersoCom/acestep.cpp)")
|
| 960 |
with gr.Row(elem_classes="compact-row"):
|
| 961 |
with gr.Column(scale=3):
|
| 962 |
audio_out = gr.Audio(label="Output", type="filepath")
|
| 963 |
status = gr.Textbox(
|
| 964 |
label="Status",
|
| 965 |
interactive=False,
|
| 966 |
-
lines=
|
| 967 |
elem_classes="status-box",
|
| 968 |
)
|
| 969 |
caption = gr.Textbox(
|
|
@@ -975,36 +975,36 @@ def gradio_main():
|
|
| 975 |
label="Lyrics",
|
| 976 |
lines=3,
|
| 977 |
value="[Instrumental]",
|
| 978 |
-
placeholder="Enter lyrics or
|
| 979 |
)
|
| 980 |
with gr.Column(scale=2):
|
| 981 |
gen_btn = gr.Button("Generate Music", variant="primary")
|
| 982 |
with gr.Row(elem_classes="compact-row"):
|
| 983 |
-
instrumental = gr.Checkbox(label="Instrumental", value=True)
|
| 984 |
bpm = gr.Number(label="BPM", value=120, minimum=0, maximum=300)
|
|
|
|
| 985 |
with gr.Row(elem_classes="compact-row"):
|
| 986 |
duration = gr.Slider(
|
| 987 |
label="Duration (s)", minimum=10, maximum=120,
|
| 988 |
value=10, step=5,
|
| 989 |
)
|
| 990 |
steps = gr.Slider(
|
| 991 |
-
label="Steps", minimum=1, maximum=32,
|
| 992 |
-
value=8, step=1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 993 |
)
|
| 994 |
-
seed = gr.Number(label="Seed (-1=random)", value=-1)
|
| 995 |
-
lora_select = gr.Dropdown(
|
| 996 |
-
label="LoRA", choices=_list_lora_choices(),
|
| 997 |
-
value="None (no LoRA)",
|
| 998 |
-
allow_custom_value=True,
|
| 999 |
-
)
|
| 1000 |
-
lm_model_select = gr.Dropdown(
|
| 1001 |
-
label="LM Model", choices=_lm_model_choices(),
|
| 1002 |
-
value=DEFAULT_LM,
|
| 1003 |
-
)
|
| 1004 |
|
| 1005 |
gen_btn.click(
|
| 1006 |
fn=generate_music,
|
| 1007 |
-
inputs=[caption, lyrics,
|
| 1008 |
seed, steps, lora_select, lm_model_select],
|
| 1009 |
outputs=[audio_out, status],
|
| 1010 |
api_name="generate",
|
|
@@ -1014,13 +1014,15 @@ def gradio_main():
|
|
| 1014 |
# Tab 2: Train LoRA
|
| 1015 |
# ============================================================
|
| 1016 |
with gr.Tab("Train LoRA"):
|
| 1017 |
-
gr.Markdown("LoRA training ported from [Side-Step](https://github.com/koda-dernet/Side-Step) | Model: [ACE-Step 1.5](https://github.com/ace-step/ACE-Step-1.5)")
|
| 1018 |
with gr.Row(elem_classes="compact-row"):
|
| 1019 |
with gr.Column(scale=3):
|
| 1020 |
train_log = gr.Textbox(
|
| 1021 |
label="Training Log",
|
| 1022 |
interactive=False,
|
| 1023 |
lines=12,
|
|
|
|
|
|
|
| 1024 |
elem_classes="status-box",
|
| 1025 |
)
|
| 1026 |
train_output_file = gr.File(label="Trained LoRA (download)", visible=False)
|
|
@@ -1036,7 +1038,7 @@ def gradio_main():
|
|
| 1036 |
cancel_btn = gr.Button("Cancel Training", variant="stop", visible=False, scale=1)
|
| 1037 |
lora_name = gr.Textbox(label="LoRA Name", value="my-lora")
|
| 1038 |
train_epochs = gr.Slider(
|
| 1039 |
-
label="Epochs (200 recommended
|
| 1040 |
minimum=1, maximum=1000,
|
| 1041 |
value=200, step=1,
|
| 1042 |
)
|
|
|
|
| 506 |
_train_log_lines = []
|
| 507 |
|
| 508 |
# -- Generate tab handler --
|
| 509 |
+
def generate_music(caption, lyrics, bpm, duration, seed,
|
| 510 |
steps, lora_select, lm_model_select,
|
| 511 |
progress=gr.Progress(track_tqdm=True)):
|
| 512 |
if not _training_lock.acquire(blocking=False):
|
|
|
|
| 515 |
if not _server_ok():
|
| 516 |
return None, "ace-server not running. Check logs."
|
| 517 |
|
| 518 |
+
if not lyrics or lyrics.strip() == "":
|
| 519 |
lyrics = "[Instrumental]"
|
| 520 |
|
| 521 |
actual_seed = None if seed is None or int(seed) < 0 else int(seed)
|
|
|
|
| 946 |
# -- Build UI --
|
| 947 |
CSS = """
|
| 948 |
.compact-row { gap: 8px !important; }
|
| 949 |
+
.status-box textarea { font-family: monospace; font-size: 13px; overflow-y: auto !important; }
|
| 950 |
"""
|
| 951 |
|
| 952 |
with gr.Blocks(title="ACE-Step 1.5 XL (CPU)") as demo:
|
|
|
|
| 956 |
# Tab 1: Generate Music
|
| 957 |
# ============================================================
|
| 958 |
with gr.Tab("Generate Music"):
|
| 959 |
+
gr.Markdown("**[ACE-Step 1.5 XL](https://github.com/ace-step/ACE-Step-1.5)** GGUF Q4_K_M via [acestep.cpp](https://github.com/ServeurpersoCom/acestep.cpp) | ~5 min for 10s audio")
|
| 960 |
with gr.Row(elem_classes="compact-row"):
|
| 961 |
with gr.Column(scale=3):
|
| 962 |
audio_out = gr.Audio(label="Output", type="filepath")
|
| 963 |
status = gr.Textbox(
|
| 964 |
label="Status",
|
| 965 |
interactive=False,
|
| 966 |
+
lines=1,
|
| 967 |
elem_classes="status-box",
|
| 968 |
)
|
| 969 |
caption = gr.Textbox(
|
|
|
|
| 975 |
label="Lyrics",
|
| 976 |
lines=3,
|
| 977 |
value="[Instrumental]",
|
| 978 |
+
placeholder="Enter lyrics here, or leave empty for instrumental (no vocals)",
|
| 979 |
)
|
| 980 |
with gr.Column(scale=2):
|
| 981 |
gen_btn = gr.Button("Generate Music", variant="primary")
|
| 982 |
with gr.Row(elem_classes="compact-row"):
|
|
|
|
| 983 |
bpm = gr.Number(label="BPM", value=120, minimum=0, maximum=300)
|
| 984 |
+
seed = gr.Number(label="Seed (-1=random)", value=-1)
|
| 985 |
with gr.Row(elem_classes="compact-row"):
|
| 986 |
duration = gr.Slider(
|
| 987 |
label="Duration (s)", minimum=10, maximum=120,
|
| 988 |
value=10, step=5,
|
| 989 |
)
|
| 990 |
steps = gr.Slider(
|
| 991 |
+
label="Steps (8 for turbo)", minimum=1, maximum=32,
|
| 992 |
+
value=8, step=1, interactive=False,
|
| 993 |
+
)
|
| 994 |
+
with gr.Row(elem_classes="compact-row"):
|
| 995 |
+
lora_select = gr.Dropdown(
|
| 996 |
+
label="LoRA", choices=_list_lora_choices(),
|
| 997 |
+
value="None (no LoRA)",
|
| 998 |
+
allow_custom_value=True,
|
| 999 |
+
)
|
| 1000 |
+
lm_model_select = gr.Dropdown(
|
| 1001 |
+
label="LM Model", choices=_lm_model_choices(),
|
| 1002 |
+
value=DEFAULT_LM,
|
| 1003 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1004 |
|
| 1005 |
gen_btn.click(
|
| 1006 |
fn=generate_music,
|
| 1007 |
+
inputs=[caption, lyrics, bpm, duration,
|
| 1008 |
seed, steps, lora_select, lm_model_select],
|
| 1009 |
outputs=[audio_out, status],
|
| 1010 |
api_name="generate",
|
|
|
|
| 1014 |
# Tab 2: Train LoRA
|
| 1015 |
# ============================================================
|
| 1016 |
with gr.Tab("Train LoRA"):
|
| 1017 |
+
gr.Markdown("LoRA training ported from [Side-Step](https://github.com/koda-dernet/Side-Step) | Model: [ACE-Step 1.5](https://github.com/ace-step/ACE-Step-1.5) | ~8h for 3 files @ 200 epochs")
|
| 1018 |
with gr.Row(elem_classes="compact-row"):
|
| 1019 |
with gr.Column(scale=3):
|
| 1020 |
train_log = gr.Textbox(
|
| 1021 |
label="Training Log",
|
| 1022 |
interactive=False,
|
| 1023 |
lines=12,
|
| 1024 |
+
max_lines=50,
|
| 1025 |
+
autoscroll=True,
|
| 1026 |
elem_classes="status-box",
|
| 1027 |
)
|
| 1028 |
train_output_file = gr.File(label="Trained LoRA (download)", visible=False)
|
|
|
|
| 1038 |
cancel_btn = gr.Button("Cancel Training", variant="stop", visible=False, scale=1)
|
| 1039 |
lora_name = gr.Textbox(label="LoRA Name", value="my-lora")
|
| 1040 |
train_epochs = gr.Slider(
|
| 1041 |
+
label="Epochs (200 recommended ~6h on CPU, best 500)",
|
| 1042 |
minimum=1, maximum=1000,
|
| 1043 |
value=200, step=1,
|
| 1044 |
)
|