xjsc0 commited on
Commit
335a61e
·
1 Parent(s): c0f6c5b
Files changed (1) hide show
  1. app.py +45 -62
app.py CHANGED
@@ -311,16 +311,17 @@ CUSTOM_CSS = """
311
 
312
  /* ---------- Disclaimer ---------- */
313
  #disclaimer {
314
- border-left: 4px solid var(--primary);
315
- background: var(--accent-glow);
316
- border-radius: 8px;
317
- padding: 12px 16px;
318
- margin: 8px 0 16px;
319
- font-size: 0.88rem;
320
- color: var(--text-muted);
321
- line-height: 1.6;
 
 
322
  }
323
- #disclaimer strong { color: var(--primary-light); }
324
 
325
  /* ---------- Section labels / 分区标题 ---------- */
326
  .section-title {
@@ -373,8 +374,8 @@ CUSTOM_CSS = """
373
  HEADER_HTML = """
374
  <div id="app-header" align="center">
375
  <h1>
376
- 🏆 LyricEditBench: The first benchmark for melody-preserving lyric modification evaluation<br>
377
- 🚀 <a href="https://github.com/ASLP-lab/YingMusic-Singer" target="_blank">YingMusic-Singer</a>
378
  </h1>
379
 
380
  <div class="lang-links">
@@ -429,11 +430,12 @@ HEADER_HTML = """
429
 
430
  DISCLAIMER_HTML = """
431
  <div id="disclaimer">
432
- <strong>⚠️ Disclaimer / 免责声明</strong>
433
  YingMusic-Singer enables the creation of singing voices with modified lyrics, supporting applications
434
  in artistic creation and entertainment. Potential risks include unauthorized voice cloning and copyright
435
  infringement. To ensure responsible deployment, users should obtain consent for voice usage, disclose
436
- AI involvement, and verify musical originality.
 
437
  </div>
438
  """
439
 
@@ -451,7 +453,6 @@ def build_ui():
451
 
452
  # ---- Header / 头部 ----
453
  gr.HTML(HEADER_HTML)
454
- gr.HTML(DISCLAIMER_HTML)
455
 
456
  gr.HTML("<hr style='border-color:#30363d; margin: 8px 0 18px;'>")
457
 
@@ -511,62 +512,43 @@ def build_ui():
511
  )
512
 
513
  # ================================================================
514
- # ROW 3 – 高级参数 / Advanced Parameters (collapsible)
515
  # ================================================================
516
  with gr.Accordion("⚙️ 高级参数 / Advanced Parameters", open=False):
517
  with gr.Row():
518
  nfe_step = gr.Slider(
519
- minimum=4,
520
- maximum=128,
521
- value=32,
522
- step=1,
523
  label="采样步数 / NFE Steps",
524
  info="更多步数 = 更高质量,但更慢 / More steps = higher quality, but slower",
525
  )
526
  cfg_strength = gr.Slider(
527
- minimum=0.0,
528
- maximum=10.0,
529
- value=3.0,
530
- step=0.1,
531
  label="CFG 强度 / CFG Strength",
532
- info="Classifier‑Free Guidance 强度 / Classifier‑Free Guidance strength",
533
  )
534
  t_shift = gr.Slider(
535
- minimum=0.0,
536
- maximum=1.0,
537
- value=0.5,
538
- step=0.01,
539
  label="采样时间偏移 / t‑shift",
540
  )
541
  with gr.Row():
542
  sil_len_to_end = gr.Slider(
543
- minimum=0.0,
544
- maximum=3.0,
545
- value=0.5,
546
- step=0.1,
547
  label="末尾静音时长 (秒) / Silence Padding (s)",
548
- info="参考音频末尾追加的静音 / Silence appended after reference audio",
549
  )
550
  seed = gr.Number(
551
- value=-1,
552
- precision=0,
553
  label="随机种子 / Random Seed",
554
  info="-1 表示随机 / -1 means random",
555
  )
556
 
557
- # ================================================================
558
- # ROW 4 – 合成按钮与输出 / Run & Output
559
- # ================================================================
560
- run_btn = gr.Button("🎤 开始合成 / Synthesize", elem_id="run-btn", size="lg")
561
-
562
- output_audio = gr.Audio(
563
- label="合成结果 / Generated Audio",
564
- type="filepath",
565
- elem_id="output-audio",
566
- )
567
 
568
  # ================================================================
569
- # ROW 5 – 示例 / Examples (two tabs)
570
  # ================================================================
571
  gr.HTML("<hr style='border-color:#30363d; margin: 20px 0 12px;'>")
572
  gr.Markdown("#### 🎵 预设示例 / Example Presets", elem_classes="section-title")
@@ -574,13 +556,6 @@ def build_ui():
574
  "<small style='color:#8b949e;'>点击任意行自动填入输入区域 / Click any row to auto-fill the inputs above</small>"
575
  )
576
 
577
- # All inputs in order expected by synthesize()
578
- _all_inputs = [
579
- ref_audio, melody_audio, ref_text, target_text,
580
- separate_vocals_flag, mix_accompaniment_flag,
581
- sil_len_to_end, t_shift, nfe_step, cfg_strength, seed,
582
- ]
583
-
584
  with gr.Tabs():
585
  with gr.Tab("🎼 Melody Control"):
586
  gr.Examples(
@@ -598,10 +573,20 @@ def build_ui():
598
  )
599
 
600
  # ================================================================
601
- # Event wiring / 事件绑定
602
  # ================================================================
 
 
 
 
 
 
 
 
603
 
604
- # 联动:未开启分离时,禁用伴奏混合
 
 
605
  separate_vocals_flag.change(
606
  fn=lambda sep: gr.update(interactive=sep, value=False if not sep else False),
607
  inputs=[separate_vocals_flag],
@@ -614,14 +599,12 @@ def build_ui():
614
  outputs=output_audio,
615
  )
616
 
617
- # ---- 页脚 / Footer ----
 
618
  gr.Markdown(
619
- """
620
- <center style="color:#8b949e; font-size:0.85rem; margin-top: 16px;">
621
- Use <code>|</code> to separate lyric phrases &nbsp;·&nbsp;
622
- 用 <code>|</code> 分隔歌词乐句
623
- </center>
624
- """,
625
  )
626
 
627
  return demo
 
311
 
312
  /* ---------- Disclaimer ---------- */
313
  #disclaimer {
314
+ border-top: 1px solid var(--border);
315
+ margin: 24px 0 4px;
316
+ padding: 14px 4px 4px;
317
+ font-size: 0.80rem;
318
+ color: #6e7681;
319
+ line-height: 1.65;
320
+ }
321
+ #disclaimer strong {
322
+ color: #8b949e;
323
+ font-weight: 600;
324
  }
 
325
 
326
  /* ---------- Section labels / 分区标题 ---------- */
327
  .section-title {
 
374
  HEADER_HTML = """
375
  <div id="app-header" align="center">
376
  <h1>
377
+ 🎤 <a href="https://github.com/ASLP-lab/YingMusic-Singer" target="_blank">YingMusic-Singer</a>:
378
+ Controllable Singing Voice Synthesis with Flexible Lyric Manipulation and Annotation-free Melody Guidance
379
  </h1>
380
 
381
  <div class="lang-links">
 
430
 
431
  DISCLAIMER_HTML = """
432
  <div id="disclaimer">
433
+ <strong>Disclaimer / 免责声明</strong><br>
434
  YingMusic-Singer enables the creation of singing voices with modified lyrics, supporting applications
435
  in artistic creation and entertainment. Potential risks include unauthorized voice cloning and copyright
436
  infringement. To ensure responsible deployment, users should obtain consent for voice usage, disclose
437
+ AI involvement, and verify musical originality.<br>
438
+ <span style="opacity:0.75;">YingMusic-Singer 可用于修改歌词后的歌声合成,支持艺术创作与娱乐应用。潜在风险包括未经授权的声音克隆与版权侵权。为确保负责任地使用,用户应在使用他人声音前获得授权、公开 AI 参与情况,并确认音乐内容的原创性。</span>
439
  </div>
440
  """
441
 
 
453
 
454
  # ---- Header / 头部 ----
455
  gr.HTML(HEADER_HTML)
 
456
 
457
  gr.HTML("<hr style='border-color:#30363d; margin: 8px 0 18px;'>")
458
 
 
512
  )
513
 
514
  # ================================================================
515
+ # ROW 3 – 高级参数(隐藏默认值)/ Advanced Parameters (hidden defaults)
516
  # ================================================================
517
  with gr.Accordion("⚙️ 高级参数 / Advanced Parameters", open=False):
518
  with gr.Row():
519
  nfe_step = gr.Slider(
520
+ minimum=4, maximum=128, value=32, step=1,
 
 
 
521
  label="采样步数 / NFE Steps",
522
  info="更多步数 = 更高质量,但更慢 / More steps = higher quality, but slower",
523
  )
524
  cfg_strength = gr.Slider(
525
+ minimum=0.0, maximum=10.0, value=3.0, step=0.1,
 
 
 
526
  label="CFG 强度 / CFG Strength",
 
527
  )
528
  t_shift = gr.Slider(
529
+ minimum=0.0, maximum=1.0, value=0.5, step=0.01,
 
 
 
530
  label="采样时间偏移 / t‑shift",
531
  )
532
  with gr.Row():
533
  sil_len_to_end = gr.Slider(
534
+ minimum=0.0, maximum=3.0, value=0.5, step=0.1,
 
 
 
535
  label="末尾静音时长 (秒) / Silence Padding (s)",
 
536
  )
537
  seed = gr.Number(
538
+ value=-1, precision=0,
 
539
  label="随机种子 / Random Seed",
540
  info="-1 表示随机 / -1 means random",
541
  )
542
 
543
+ # All inputs in order expected by synthesize()
544
+ _all_inputs = [
545
+ ref_audio, melody_audio, ref_text, target_text,
546
+ separate_vocals_flag, mix_accompaniment_flag,
547
+ sil_len_to_end, t_shift, nfe_step, cfg_strength, seed,
548
+ ]
 
 
 
 
549
 
550
  # ================================================================
551
+ # ROW 4预设示例 / Example Presets
552
  # ================================================================
553
  gr.HTML("<hr style='border-color:#30363d; margin: 20px 0 12px;'>")
554
  gr.Markdown("#### 🎵 预设示例 / Example Presets", elem_classes="section-title")
 
556
  "<small style='color:#8b949e;'>点击任意行自动填入输入区域 / Click any row to auto-fill the inputs above</small>"
557
  )
558
 
 
 
 
 
 
 
 
559
  with gr.Tabs():
560
  with gr.Tab("🎼 Melody Control"):
561
  gr.Examples(
 
573
  )
574
 
575
  # ================================================================
576
+ # ROW 5 – 合成按钮与输出 / Run & Output
577
  # ================================================================
578
+ gr.HTML("<hr style='border-color:#30363d; margin: 12px 0;'>")
579
+ run_btn = gr.Button("🎤 开始合成 / Synthesize", elem_id="run-btn", size="lg")
580
+
581
+ output_audio = gr.Audio(
582
+ label="合成结果 / Generated Audio",
583
+ type="filepath",
584
+ elem_id="output-audio",
585
+ )
586
 
587
+ # ================================================================
588
+ # Event wiring / 事件绑定
589
+ # ================================================================
590
  separate_vocals_flag.change(
591
  fn=lambda sep: gr.update(interactive=sep, value=False if not sep else False),
592
  inputs=[separate_vocals_flag],
 
599
  outputs=output_audio,
600
  )
601
 
602
+ # ---- 页脚:免责声明 + 使用提示 / Footer: disclaimer + tip ----
603
+ gr.HTML(DISCLAIMER_HTML)
604
  gr.Markdown(
605
+ "<center style='color:#6e7681; font-size:0.78rem; margin-top: 4px;'>"
606
+ "Use <code>|</code> to separate lyric phrases &nbsp;·&nbsp; 用 <code>|</code> 分隔歌词乐句"
607
+ "</center>",
 
 
 
608
  )
609
 
610
  return demo