Spaces:
Paused
Paused
koby commited on
Commit ·
4ee0f46
1
Parent(s): bf455aa
auto-refresh community feed after each generation + auto-load on page open
Browse files
app.py
CHANGED
|
@@ -449,7 +449,7 @@ with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
|
|
| 449 |
mp3_file = gr.File(label="📥 Download MP3 (320kbps)")
|
| 450 |
info = gr.Textbox(label="ℹ️ Generation Info", interactive=False)
|
| 451 |
|
| 452 |
-
btn.click(
|
| 453 |
fn=generate,
|
| 454 |
inputs=[style, lyrics, cot, seed, cfg, title_input, bpm_input, lang_input, tags_input],
|
| 455 |
outputs=[audio, mp3_file, info],
|
|
@@ -460,7 +460,7 @@ with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
|
|
| 460 |
gr.Markdown(
|
| 461 |
"Latest songs generated by users — auto-shared to the "
|
| 462 |
"[YuE2-community dataset](https://huggingface.co/datasets/directedbykobyperez/YuE2-community). "
|
| 463 |
-
"
|
| 464 |
)
|
| 465 |
with gr.Row():
|
| 466 |
search_box = gr.Textbox(label="🔍 Search (title / prompt / lyrics / tags / id)", value="", lines=1, scale=4)
|
|
@@ -475,4 +475,18 @@ with gr.Blocks(css=custom_css, title="YuE2-3B Music Generator") as demo:
|
|
| 475 |
outputs=[feed_html, feed_status],
|
| 476 |
)
|
| 477 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
demo.queue().launch()
|
|
|
|
| 449 |
mp3_file = gr.File(label="📥 Download MP3 (320kbps)")
|
| 450 |
info = gr.Textbox(label="ℹ️ Generation Info", interactive=False)
|
| 451 |
|
| 452 |
+
gen_event = btn.click(
|
| 453 |
fn=generate,
|
| 454 |
inputs=[style, lyrics, cot, seed, cfg, title_input, bpm_input, lang_input, tags_input],
|
| 455 |
outputs=[audio, mp3_file, info],
|
|
|
|
| 460 |
gr.Markdown(
|
| 461 |
"Latest songs generated by users — auto-shared to the "
|
| 462 |
"[YuE2-community dataset](https://huggingface.co/datasets/directedbykobyperez/YuE2-community). "
|
| 463 |
+
"The feed loads automatically and refreshes after each generation."
|
| 464 |
)
|
| 465 |
with gr.Row():
|
| 466 |
search_box = gr.Textbox(label="🔍 Search (title / prompt / lyrics / tags / id)", value="", lines=1, scale=4)
|
|
|
|
| 475 |
outputs=[feed_html, feed_status],
|
| 476 |
)
|
| 477 |
|
| 478 |
+
# auto-refresh feed right after each generation (CPU-only, no extra GPU time)
|
| 479 |
+
gen_event.then(
|
| 480 |
+
fn=refresh_feed,
|
| 481 |
+
inputs=[search_box, limit_slider],
|
| 482 |
+
outputs=[feed_html, feed_status],
|
| 483 |
+
)
|
| 484 |
+
|
| 485 |
+
# auto-load feed on page open so users see songs without pressing Refresh
|
| 486 |
+
demo.load(
|
| 487 |
+
fn=refresh_feed,
|
| 488 |
+
inputs=[search_box, limit_slider],
|
| 489 |
+
outputs=[feed_html, feed_status],
|
| 490 |
+
)
|
| 491 |
+
|
| 492 |
demo.queue().launch()
|