Spaces:
Paused
Paused
koby commited on
Commit ยท
ec8e3f6
1
Parent(s): ba46d02
search box is now Search By Tags (comma-separated, matches tags)
Browse files
app.py
CHANGED
|
@@ -339,13 +339,10 @@ def refresh_feed(search, limit):
|
|
| 339 |
total = len(songs)
|
| 340 |
q = (search or "").strip().lower()
|
| 341 |
if q:
|
|
|
|
| 342 |
def _match(m):
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
str(m.get("description", "")), str(m.get("lyrics", "")),
|
| 346 |
-
str(m.get("tags", "")), str(m.get("id", "")),
|
| 347 |
-
]).lower()
|
| 348 |
-
return q in blob
|
| 349 |
songs = [m for m in songs if _match(m)]
|
| 350 |
shown = songs[:limit]
|
| 351 |
html_out = render_feed_html(shown)
|
|
@@ -480,7 +477,7 @@ with gr.Blocks(title="YuE2-3B Music Generator") as demo:
|
|
| 480 |
with gr.Column(scale=6):
|
| 481 |
gr.Markdown("### ๐ Latest Community Songs")
|
| 482 |
with gr.Row():
|
| 483 |
-
search_box = gr.Textbox(label="๐ Search", value="", placeholder="
|
| 484 |
limit_slider = gr.Slider(5, 60, value=20, step=5, label="How many")
|
| 485 |
refresh_btn = gr.Button("๐ Refresh", scale=1)
|
| 486 |
feed_status = gr.Textbox(label="Status", interactive=False, value="Loading songs...")
|
|
|
|
| 339 |
total = len(songs)
|
| 340 |
q = (search or "").strip().lower()
|
| 341 |
if q:
|
| 342 |
+
wanted = [t.strip() for t in q.replace(";", ",").split(",") if t.strip()]
|
| 343 |
def _match(m):
|
| 344 |
+
tags = str(m.get("tags", "")).lower()
|
| 345 |
+
return any(w in tags for w in wanted)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
songs = [m for m in songs if _match(m)]
|
| 347 |
shown = songs[:limit]
|
| 348 |
html_out = render_feed_html(shown)
|
|
|
|
| 477 |
with gr.Column(scale=6):
|
| 478 |
gr.Markdown("### ๐ Latest Community Songs")
|
| 479 |
with gr.Row():
|
| 480 |
+
search_box = gr.Textbox(label="๐ Search By Tags", value="", placeholder="e.g. pop, cinematic", lines=1, scale=4)
|
| 481 |
limit_slider = gr.Slider(5, 60, value=20, step=5, label="How many")
|
| 482 |
refresh_btn = gr.Button("๐ Refresh", scale=1)
|
| 483 |
feed_status = gr.Textbox(label="Status", interactive=False, value="Loading songs...")
|