+
{t("app.title")}
+
{t("app.subtitle")}
+
+
+ 🚀 Want faster & more stable experience? Try
+ acemusic.ai
+ — 100% free!
+
+
+
+ Project |
+ Hugging Face |
+ ModelScope |
+ GitHub |
+ Discord |
+ Technical Report
+
+
+ """)
+
+ # Dataset Explorer Section
+ dataset_section = create_dataset_section(dataset_handler)
+
+ # Generation Section (pass init_params and language to support pre-initialization)
+ generation_section = create_generation_section(dit_handler, llm_handler, init_params=init_params, language=language)
+
+ # Results Section
+ results_section = create_results_section(dit_handler)
+
+ # Training Section (LoRA training and dataset builder)
+ # Pass init_params to support hiding in service mode
+ training_section = create_training_section(dit_handler, llm_handler, init_params=init_params)
+
+ # Connect event handlers (pass init_params for multi-model support)
+ setup_event_handlers(demo, dit_handler, llm_handler, dataset_handler, dataset_section, generation_section, results_section, init_params=init_params)
+
+ # Connect training event handlers
+ setup_training_event_handlers(demo, dit_handler, llm_handler, training_section)
+
+ return demo
diff --git a/acestep/gradio_ui/interfaces/dataset.py b/acestep/gradio_ui/interfaces/dataset.py
new file mode 100644
index 0000000000000000000000000000000000000000..224ee856cd6c2c7f840b62f2ebe5562259d7c95a
--- /dev/null
+++ b/acestep/gradio_ui/interfaces/dataset.py
@@ -0,0 +1,101 @@
+"""
+Gradio UI Dataset Section Module
+Contains dataset explorer section component definitions
+"""
+import gradio as gr
+
+
+def create_dataset_section(dataset_handler) -> dict:
+ """Create dataset explorer section"""
+ with gr.Accordion("📊 Dataset Explorer", open=False, visible=False):
+ with gr.Row(equal_height=True):
+ dataset_type = gr.Dropdown(
+ choices=["train", "test"],
+ value="train",
+ label="Dataset",
+ info="Choose dataset to explore",
+ scale=2
+ )
+ import_dataset_btn = gr.Button("📥 Import Dataset", variant="primary", scale=1)
+
+ search_type = gr.Dropdown(
+ choices=["keys", "idx", "random"],
+ value="random",
+ label="Search Type",
+ info="How to find items",
+ scale=1
+ )
+ search_value = gr.Textbox(
+ label="Search Value",
+ placeholder="Enter keys or index (leave empty for random)",
+ info="Keys: exact match, Index: 0 to dataset size-1",
+ scale=2
+ )
+
+ instruction_display = gr.Textbox(
+ label="📝 Instruction",
+ interactive=False,
+ placeholder="No instruction available",
+ lines=1
+ )
+
+ repaint_viz_plot = gr.Plot()
+
+ with gr.Accordion("📋 Item Metadata (JSON)", open=False):
+ item_info_json = gr.Code(
+ label="Complete Item Information",
+ language="json",
+ interactive=False,
+ lines=15
+ )
+
+ with gr.Row(equal_height=True):
+ item_src_audio = gr.Audio(
+ label="Source Audio",
+ type="filepath",
+ interactive=False,
+ scale=8
+ )
+ get_item_btn = gr.Button("🔍 Get Item", variant="secondary", interactive=False, scale=2)
+
+ with gr.Row(equal_height=True):
+ item_target_audio = gr.Audio(
+ label="Target Audio",
+ type="filepath",
+ interactive=False,
+ scale=8
+ )
+ item_refer_audio = gr.Audio(
+ label="Reference Audio",
+ type="filepath",
+ interactive=False,
+ scale=2
+ )
+
+ with gr.Row():
+ use_src_checkbox = gr.Checkbox(
+ label="Use Source Audio from Dataset",
+ value=True,
+ info="Check to use the source audio from dataset"
+ )
+
+ data_status = gr.Textbox(label="📊 Data Status", interactive=False, value="❌ No dataset imported")
+ auto_fill_btn = gr.Button("📋 Auto-fill Generation Form", variant="primary")
+
+ return {
+ "dataset_type": dataset_type,
+ "import_dataset_btn": import_dataset_btn,
+ "search_type": search_type,
+ "search_value": search_value,
+ "instruction_display": instruction_display,
+ "repaint_viz_plot": repaint_viz_plot,
+ "item_info_json": item_info_json,
+ "item_src_audio": item_src_audio,
+ "get_item_btn": get_item_btn,
+ "item_target_audio": item_target_audio,
+ "item_refer_audio": item_refer_audio,
+ "use_src_checkbox": use_src_checkbox,
+ "data_status": data_status,
+ "auto_fill_btn": auto_fill_btn,
+ }
+
diff --git a/acestep/gradio_ui/interfaces/generation.py b/acestep/gradio_ui/interfaces/generation.py
new file mode 100644
index 0000000000000000000000000000000000000000..6c4c933b95d00c98ae9df0b9e3d0d861bff24d7f
--- /dev/null
+++ b/acestep/gradio_ui/interfaces/generation.py
@@ -0,0 +1,694 @@
+"""
+Gradio UI Generation Section Module
+Contains generation section component definitions - Simplified UI
+"""
+import gradio as gr
+from acestep.constants import (
+ VALID_LANGUAGES,
+ TRACK_NAMES,
+ TASK_TYPES_TURBO,
+ TASK_TYPES_BASE,
+ DEFAULT_DIT_INSTRUCTION,
+)
+from acestep.gradio_ui.i18n import t
+
+
+def create_generation_section(dit_handler, llm_handler, init_params=None, language='en') -> dict:
+ """Create generation section with simplified UI
+
+ Args:
+ dit_handler: DiT handler instance
+ llm_handler: LM handler instance
+ init_params: Dictionary containing initialization parameters and state.
+ If None, service will not be pre-initialized.
+ language: UI language code ('en', 'zh', 'ja')
+ """
+ # Check if service is pre-initialized
+ service_pre_initialized = init_params is not None and init_params.get('pre_initialized', False)
+
+ # Check if running in service mode (restricted UI)
+ service_mode = init_params is not None and init_params.get('service_mode', False)
+
+ # Get current language from init_params if available
+ current_language = init_params.get('language', language) if init_params else language
+
+ # Get available models
+ available_dit_models = init_params.get('available_dit_models', []) if init_params else []
+ current_model_value = init_params.get('config_path', '') if init_params else ''
+ show_model_selector = len(available_dit_models) > 1
+
+ with gr.Group():
+ # ==================== Service Configuration (Hidden in service mode) ====================
+ accordion_open = not service_pre_initialized
+ accordion_visible = not service_pre_initialized
+ with gr.Accordion(t("service.title"), open=accordion_open, visible=accordion_visible) as service_config_accordion:
+ # Language selector at the top
+ with gr.Row():
+ language_dropdown = gr.Dropdown(
+ choices=[
+ ("English", "en"),
+ ("中文", "zh"),
+ ("日本語", "ja"),
+ ],
+ value=current_language,
+ label=t("service.language_label"),
+ info=t("service.language_info"),
+ scale=1,
+ )
+
+ with gr.Row(equal_height=True):
+ with gr.Column(scale=4):
+ checkpoint_value = init_params.get('checkpoint') if service_pre_initialized else None
+ checkpoint_dropdown = gr.Dropdown(
+ label=t("service.checkpoint_label"),
+ choices=dit_handler.get_available_checkpoints(),
+ value=checkpoint_value,
+ info=t("service.checkpoint_info")
+ )
+ with gr.Column(scale=1, min_width=90):
+ refresh_btn = gr.Button(t("service.refresh_btn"), size="sm")
+
+ with gr.Row():
+ available_models = dit_handler.get_available_acestep_v15_models()
+ default_model = "acestep-v15-turbo" if "acestep-v15-turbo" in available_models else (available_models[0] if available_models else None)
+ config_path_value = init_params.get('config_path', default_model) if service_pre_initialized else default_model
+ config_path = gr.Dropdown(
+ label=t("service.model_path_label"),
+ choices=available_models,
+ value=config_path_value,
+ info=t("service.model_path_info")
+ )
+ device_value = init_params.get('device', 'auto') if service_pre_initialized else 'auto'
+ device = gr.Dropdown(
+ choices=["auto", "cuda", "cpu"],
+ value=device_value,
+ label=t("service.device_label"),
+ info=t("service.device_info")
+ )
+
+ with gr.Row():
+ available_lm_models = llm_handler.get_available_5hz_lm_models()
+ default_lm_model = "acestep-5Hz-lm-0.6B" if "acestep-5Hz-lm-0.6B" in available_lm_models else (available_lm_models[0] if available_lm_models else None)
+ lm_model_path_value = init_params.get('lm_model_path', default_lm_model) if service_pre_initialized else default_lm_model
+ lm_model_path = gr.Dropdown(
+ label=t("service.lm_model_path_label"),
+ choices=available_lm_models,
+ value=lm_model_path_value,
+ info=t("service.lm_model_path_info")
+ )
+ backend_value = init_params.get('backend', 'vllm') if service_pre_initialized else 'vllm'
+ backend_dropdown = gr.Dropdown(
+ choices=["vllm", "pt"],
+ value=backend_value,
+ label=t("service.backend_label"),
+ info=t("service.backend_info")
+ )
+
+ with gr.Row():
+ init_llm_value = init_params.get('init_llm', True) if service_pre_initialized else True
+ init_llm_checkbox = gr.Checkbox(
+ label=t("service.init_llm_label"),
+ value=init_llm_value,
+ info=t("service.init_llm_info"),
+ )
+ flash_attn_available = dit_handler.is_flash_attention_available()
+ use_flash_attention_value = init_params.get('use_flash_attention', flash_attn_available) if service_pre_initialized else flash_attn_available
+ use_flash_attention_checkbox = gr.Checkbox(
+ label=t("service.flash_attention_label"),
+ value=use_flash_attention_value,
+ interactive=flash_attn_available,
+ info=t("service.flash_attention_info_enabled") if flash_attn_available else t("service.flash_attention_info_disabled")
+ )
+ offload_to_cpu_value = init_params.get('offload_to_cpu', False) if service_pre_initialized else False
+ offload_to_cpu_checkbox = gr.Checkbox(
+ label=t("service.offload_cpu_label"),
+ value=offload_to_cpu_value,
+ info=t("service.offload_cpu_info")
+ )
+ offload_dit_to_cpu_value = init_params.get('offload_dit_to_cpu', False) if service_pre_initialized else False
+ offload_dit_to_cpu_checkbox = gr.Checkbox(
+ label=t("service.offload_dit_cpu_label"),
+ value=offload_dit_to_cpu_value,
+ info=t("service.offload_dit_cpu_info")
+ )
+
+ init_btn = gr.Button(t("service.init_btn"), variant="primary", size="lg")
+ init_status_value = init_params.get('init_status', '') if service_pre_initialized else ''
+ init_status = gr.Textbox(label=t("service.status_label"), interactive=False, lines=3, value=init_status_value)
+
+ # LoRA Configuration Section
+ gr.HTML("