koby commited on
Commit
a3ffcd6
Β·
1 Parent(s): 5a1998f

single-page layout: generator left, community feed right; hide gradio footer + api link

Browse files
Files changed (1) hide show
  1. app.py +63 -67
app.py CHANGED
@@ -395,6 +395,8 @@ body {
395
  .song-links a { color: #a855f7; text-decoration: none; margin-right: 8px; }
396
  .empty-feed { text-align: center; padding: 40px 10px; color: #94a3b8; }
397
  audio::-webkit-media-controls-panel { background: #1f2937; }
 
 
398
  """
399
 
400
  with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
@@ -411,79 +413,73 @@ with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
411
  """
412
  )
413
 
414
- with gr.Tabs():
415
- with gr.Tab("🎡 Generate"):
416
- with gr.Row():
417
- with gr.Column(scale=5):
418
- title_input = gr.Textbox(
419
- label="🏷️ Title (optional β€” auto from style if empty)",
420
- value="",
421
- placeholder="e.g. Reggaeton Latin Spanish Old",
422
- lines=1,
423
- )
424
- style = gr.Textbox(
425
- label="🎨 Style Prompt",
426
- value="Cyber metal, English, aggressive male vocals, distorted guitars, double-kick drums",
427
- lines=3
428
- )
429
- tags_input = gr.Textbox(
430
- label="🏷️ Tags (comma separated, shown in community feed)",
431
- value="",
432
- placeholder="e.g. pop, melodic, cinematic",
433
- lines=1,
434
- )
435
- lyrics = gr.Textbox(
436
- label="πŸ“œ Lyrics ([verse] / [chorus] structure)",
437
- value="[verse]\nnothing here but static skies\nwe ride the current till it dies",
438
- lines=8
439
- )
440
- with gr.Row():
441
- cot = gr.Radio(["full", "melody", "off"], value="full", label="CoT Mode")
442
- seed = gr.Number(label="Seed (0 for Random)", value=0, precision=0)
443
- cfg = gr.Number(label="CFG Scale", value=1.0, precision=2)
444
- with gr.Row():
445
- bpm_input = gr.Number(label="BPM", value=120, precision=0)
446
- lang_input = gr.Textbox(label="Language", value="en", lines=1)
447
-
448
- btn = gr.Button("πŸš€ Generate Song", elem_classes=["generate-btn"])
449
-
450
- with gr.Column(scale=5):
451
- audio = gr.Audio(label="🎧 Generated Song Player", type="filepath")
452
- mp3_file = gr.File(label="πŸ“₯ Download MP3 (320kbps)")
453
- info = gr.Textbox(label="ℹ️ Generation Info", interactive=False)
454
-
455
- gen_event = btn.click(
456
- fn=generate,
457
- inputs=[style, lyrics, cot, seed, cfg, title_input, bpm_input, lang_input, tags_input],
458
- outputs=[audio, mp3_file, info],
459
- queue=True
460
  )
461
-
462
- with gr.Tab("🌍 Community Songs"):
463
- gr.Markdown(
464
- "Latest songs generated by users β€” auto-shared to the "
465
- "[YuE2-community dataset](https://huggingface.co/datasets/directedbykobyperez/YuE2-community). "
466
- "The feed loads automatically and refreshes after each generation."
 
 
 
 
467
  )
 
 
 
 
 
 
 
 
 
468
  with gr.Row():
469
- search_box = gr.Textbox(label="πŸ” Search (title / prompt / lyrics / tags / id)", value="", lines=1, scale=4)
 
 
 
 
 
 
 
 
 
 
 
 
470
  limit_slider = gr.Slider(5, 60, value=20, step=5, label="How many")
471
  refresh_btn = gr.Button("πŸ”„ Refresh", scale=1)
472
- feed_status = gr.Textbox(label="Status", interactive=False, value="Press Refresh to load songs.")
473
- feed_html = gr.HTML("<div class='empty-feed'>Press πŸ”„ Refresh to load the latest community songs.</div>")
 
 
 
 
 
 
 
474
 
475
- refresh_btn.click(
476
- fn=refresh_feed,
477
- inputs=[search_box, limit_slider],
478
- outputs=[feed_html, feed_status],
479
- )
480
 
481
- # auto-refresh feed right after each generation (CPU-only, no extra GPU time)
482
- gen_event.then(
483
- fn=refresh_feed,
484
- inputs=[search_box, limit_slider],
485
- outputs=[feed_html, feed_status],
486
- )
487
 
488
  # auto-load feed on page open so users see songs without pressing Refresh
489
  demo.load(
@@ -492,4 +488,4 @@ with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
492
  outputs=[feed_html, feed_status],
493
  )
494
 
495
- demo.queue().launch()
 
395
  .song-links a { color: #a855f7; text-decoration: none; margin-right: 8px; }
396
  .empty-feed { text-align: center; padding: 40px 10px; color: #94a3b8; }
397
  audio::-webkit-media-controls-panel { background: #1f2937; }
398
+ /* hide Gradio footer: Use via API Β· Built with Gradio Β· Settings */
399
+ footer { display: none !important; }
400
  """
401
 
402
  with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
 
413
  """
414
  )
415
 
416
+ with gr.Row():
417
+ # LEFT: generator
418
+ with gr.Column(scale=5):
419
+ title_input = gr.Textbox(
420
+ label="🏷️ Title (optional β€” auto from style if empty)",
421
+ value="",
422
+ placeholder="e.g. Reggaeton Latin Spanish Old",
423
+ lines=1,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  )
425
+ style = gr.Textbox(
426
+ label="🎨 Style Prompt",
427
+ value="Cyber metal, English, aggressive male vocals, distorted guitars, double-kick drums",
428
+ lines=3
429
+ )
430
+ tags_input = gr.Textbox(
431
+ label="🏷️ Tags (comma separated, shown in community feed)",
432
+ value="",
433
+ placeholder="e.g. pop, melodic, cinematic",
434
+ lines=1,
435
  )
436
+ lyrics = gr.Textbox(
437
+ label="πŸ“œ Lyrics ([verse] / [chorus] structure)",
438
+ value="[verse]\nnothing here but static skies\nwe ride the current till it dies",
439
+ lines=8
440
+ )
441
+ with gr.Row():
442
+ cot = gr.Radio(["full", "melody", "off"], value="full", label="CoT Mode")
443
+ seed = gr.Number(label="Seed (0 for Random)", value=0, precision=0)
444
+ cfg = gr.Number(label="CFG Scale", value=1.0, precision=2)
445
  with gr.Row():
446
+ bpm_input = gr.Number(label="BPM", value=120, precision=0)
447
+ lang_input = gr.Textbox(label="Language", value="en", lines=1)
448
+
449
+ btn = gr.Button("πŸš€ Generate Song", elem_classes=["generate-btn"])
450
+ audio = gr.Audio(label="🎧 Generated Song Player", type="filepath")
451
+ mp3_file = gr.File(label="πŸ“₯ Download MP3 (320kbps)")
452
+ info = gr.Textbox(label="ℹ️ Generation Info", interactive=False)
453
+
454
+ # RIGHT: community generations
455
+ with gr.Column(scale=6):
456
+ gr.Markdown("### 🌍 Latest Community Songs")
457
+ with gr.Row():
458
+ search_box = gr.Textbox(label="πŸ” Search", value="", placeholder="title / prompt / lyrics / tags / id", lines=1, scale=4)
459
  limit_slider = gr.Slider(5, 60, value=20, step=5, label="How many")
460
  refresh_btn = gr.Button("πŸ”„ Refresh", scale=1)
461
+ feed_status = gr.Textbox(label="Status", interactive=False, value="Loading songs...")
462
+ feed_html = gr.HTML("<div class='empty-feed'>Loading latest community songs...</div>")
463
+
464
+ gen_event = btn.click(
465
+ fn=generate,
466
+ inputs=[style, lyrics, cot, seed, cfg, title_input, bpm_input, lang_input, tags_input],
467
+ outputs=[audio, mp3_file, info],
468
+ queue=True
469
+ )
470
 
471
+ refresh_btn.click(
472
+ fn=refresh_feed,
473
+ inputs=[search_box, limit_slider],
474
+ outputs=[feed_html, feed_status],
475
+ )
476
 
477
+ # auto-refresh feed right after each generation (CPU-only, no extra GPU time)
478
+ gen_event.then(
479
+ fn=refresh_feed,
480
+ inputs=[search_box, limit_slider],
481
+ outputs=[feed_html, feed_status],
482
+ )
483
 
484
  # auto-load feed on page open so users see songs without pressing Refresh
485
  demo.load(
 
488
  outputs=[feed_html, feed_status],
489
  )
490
 
491
+ demo.queue().launch(show_api=False)