Update app.py
Browse files
app.py
CHANGED
|
@@ -84,25 +84,42 @@ STRUCTURE_TAGS = [
|
|
| 84 |
"[Interlude]", "[Hook]", "[Outro]", "[Inst]", "[Solo]"
|
| 85 |
]
|
| 86 |
|
| 87 |
-
# HeartMuLa ์คํ์ผ ํ๊ทธ ๊ฐ์ด๋
|
| 88 |
HEARTMULA_TAG_GUIDE = """
|
| 89 |
-
## ๐ผ HeartMuLa
|
| 90 |
|
| 91 |
-
###
|
| 92 |
-
|
|
|
|
| 93 |
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
```
|
| 96 |
piano,happy,wedding,synthesizer,romantic
|
| 97 |
-
|
| 98 |
-
|
| 99 |
```
|
| 100 |
|
| 101 |
-
###
|
| 102 |
-
|
| 103 |
-
**
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
"""
|
| 107 |
|
| 108 |
# HeartMuLa ๊ถ์ฅ ๊ฐ์ฌ ๊ตฌ์กฐ
|
|
@@ -190,20 +207,20 @@ Every single day"""
|
|
| 190 |
|
| 191 |
EXAMPLE_TAGS = "piano,happy,uplifting,pop"
|
| 192 |
|
| 193 |
-
# ์์ ํ๋กฌํํธ (ํ๊ทธ ์ธํธ)
|
| 194 |
EXAMPLE_TAG_PRESETS = {
|
| 195 |
-
"
|
| 196 |
-
"
|
| 197 |
-
"
|
| 198 |
-
"
|
| 199 |
-
"
|
| 200 |
-
"
|
| 201 |
-
"
|
| 202 |
-
"
|
| 203 |
-
"
|
| 204 |
-
"
|
| 205 |
-
"
|
| 206 |
-
"
|
| 207 |
}
|
| 208 |
|
| 209 |
|
|
@@ -287,21 +304,35 @@ CRITICAL OUTPUT RULES:
|
|
| 287 |
OUTPUT ONLY CLEAN LYRICS WITH OPTIMAL TAG STRUCTURE IN THE ORIGINAL LANGUAGE."""
|
| 288 |
}
|
| 289 |
|
| 290 |
-
# ํ๊ทธ ์์ฑ ์์ด์ ํธ
|
| 291 |
-
TAG_AGENT = f"""You are a style tag generator for HeartMuLa.
|
| 292 |
|
| 293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
|
| 295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
|
| 297 |
RULES:
|
| 298 |
-
1.
|
| 299 |
-
2. Use
|
| 300 |
-
3.
|
| 301 |
-
4. Be specific: "piano" not "keyboard", "guitar" not "strings"
|
| 302 |
|
| 303 |
-
OUTPUT FORMAT (
|
| 304 |
-
piano,
|
|
|
|
|
|
|
|
|
|
| 305 |
|
| 306 |
Output ONLY the comma-separated tags, nothing else."""
|
| 307 |
|
|
@@ -400,7 +431,7 @@ def clean_tags(tags: str) -> str:
|
|
| 400 |
@spaces.GPU(duration=120)
|
| 401 |
def generate_lyrics_soma(
|
| 402 |
api_key: str, theme: str, genre: str, mood: str,
|
| 403 |
-
language: str,
|
| 404 |
progress=gr.Progress()
|
| 405 |
):
|
| 406 |
"""SOMA ๊ฐ์ฌ ์์ฑ"""
|
|
@@ -414,12 +445,13 @@ def generate_lyrics_soma(
|
|
| 414 |
- Genre: {genre}
|
| 415 |
- Mood: {mood}
|
| 416 |
- Language: {language} โ CRITICAL: You MUST write ALL lyrics in {language} language!
|
| 417 |
-
- Vocal Type: {vocal_type}
|
| 418 |
{f'- Additional: {additional}' if additional else ''}
|
| 419 |
|
| 420 |
โ ๏ธ LANGUAGE REQUIREMENT: Write the ENTIRE lyrics in {language}!
|
| 421 |
-
{"- ๋ฐ๋์ ํ๊ตญ์ด๋ก ๊ฐ์ฌ๋ฅผ ์์ฑํ์ธ์!
|
| 422 |
-
{"-
|
|
|
|
|
|
|
| 423 |
|
| 424 |
USE HeartMuLa STRUCTURE TAGS:
|
| 425 |
[Intro], [Verse], [Prechorus], [Chorus], [Bridge], [Interlude], [Hook], [Outro]
|
|
@@ -455,8 +487,14 @@ REMEMBER: ALL lyrics must be in {language}!"""
|
|
| 455 |
return f"โ {emotional}", draft, structured, "", ""
|
| 456 |
|
| 457 |
progress(0.8, desc="โจ ์ต์ข
ํธ์ง...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
final = call_groq(api_key, LYRICS_AGENTS["final_editor"],
|
| 459 |
-
f"Output ONLY clean lyrics in {language}. Use [Prechorus] not [Pre Chorus]! {
|
| 460 |
if final.startswith("Error:"):
|
| 461 |
return f"โ {final}", draft, structured, emotional, ""
|
| 462 |
|
|
@@ -470,7 +508,7 @@ REMEMBER: ALL lyrics must be in {language}!"""
|
|
| 470 |
|
| 471 |
|
| 472 |
@spaces.GPU(duration=60)
|
| 473 |
-
def quick_lyrics(api_key: str, theme: str, genre: str, mood: str, language: str,
|
| 474 |
"""๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ"""
|
| 475 |
if not api_key or not api_key.strip():
|
| 476 |
return "โ API Key ํ์"
|
|
@@ -482,12 +520,13 @@ def quick_lyrics(api_key: str, theme: str, genre: str, mood: str, language: str,
|
|
| 482 |
- Genre: {genre}
|
| 483 |
- Mood: {mood}
|
| 484 |
- Language: {language} โ CRITICAL: Write ALL lyrics in {language}!
|
| 485 |
-
- Vocal: {vocal_type}
|
| 486 |
{f'- Special: {additional}' if additional else ''}
|
| 487 |
|
| 488 |
โ ๏ธ LANGUAGE: You MUST write the ENTIRE lyrics in {language}!
|
| 489 |
-
{"๋ฐ๋์ ํ๊ตญ์ด๋ก ์์ฑํ์ธ์! ํ๊ธ ๊ฐ์ฌ๋ง
|
| 490 |
-
{"
|
|
|
|
|
|
|
| 491 |
|
| 492 |
USE STRUCTURE (8-10 sections):
|
| 493 |
[Intro] โ [Verse] โ [Prechorus] โ [Chorus] โ [Verse] โ [Prechorus] โ [Chorus] โ [Bridge] โ [Chorus] โ [Outro]
|
|
@@ -510,18 +549,24 @@ Output ONLY clean lyrics.""", prompt)
|
|
| 510 |
|
| 511 |
|
| 512 |
@spaces.GPU(duration=60)
|
| 513 |
-
def generate_tags_ai(api_key: str, genre: str, mood: str,
|
| 514 |
-
"""AI ํ๊ทธ ์์ฑ"""
|
| 515 |
if not api_key:
|
| 516 |
return "piano,happy,pop"
|
| 517 |
|
| 518 |
-
prompt = f"""Generate HeartMuLa style tags:
|
| 519 |
- Genre: {genre}
|
| 520 |
- Mood: {mood}
|
| 521 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
|
| 523 |
-
Output
|
| 524 |
-
Example: piano,
|
| 525 |
|
| 526 |
try:
|
| 527 |
result = call_groq(api_key, TAG_AGENT, prompt)
|
|
@@ -770,19 +815,15 @@ with gr.Blocks(css=css, title="๐ต SOMA Music Studio - HeartMuLa") as demo:
|
|
| 770 |
|
| 771 |
with gr.Row():
|
| 772 |
lyrics_language = gr.Dropdown(
|
| 773 |
-
label="๐ ์ธ์ด",
|
| 774 |
-
choices=["English", "Korean", "
|
| 775 |
-
value="English"
|
| 776 |
-
|
| 777 |
-
lyrics_vocal_type = gr.Dropdown(
|
| 778 |
-
label="๐ค ๋ณด์ปฌ",
|
| 779 |
-
choices=["Solo Female", "Solo Male", "Duet", "Group/Choir"],
|
| 780 |
-
value="Solo Female"
|
| 781 |
)
|
| 782 |
|
| 783 |
lyrics_additional = gr.Textbox(
|
| 784 |
label="โจ ์ถ๊ฐ ์ง์ (์ ํ)",
|
| 785 |
-
placeholder="ํน๋ณ ์์ฒญ...",
|
| 786 |
lines=1
|
| 787 |
)
|
| 788 |
|
|
@@ -866,13 +907,38 @@ with gr.Blocks(css=css, title="๐ต SOMA Music Studio - HeartMuLa") as demo:
|
|
| 866 |
### ๐ก Tips
|
| 867 |
- **๊ตฌ์กฐ ํ๊ทธ:** [Intro], [Verse], [Prechorus], [Chorus], [Bridge], [Outro]
|
| 868 |
- **์คํ์ผ ํ๊ทธ:** piano,happy,uplifting,pop (์ฝค๋ง ๊ตฌ๋ถ, ๊ณต๋ฐฑ ์์!)
|
|
|
|
|
|
|
| 869 |
- **Temperature:** ๋์ผ๋ฉด ์ฐฝ์์ , ๋ฎ์ผ๋ฉด ์ผ๊ด์ฑ
|
| 870 |
-
- **๊ธธ์ด:** ๊ธด ๊ณก์ ์๊ฐ์ด ๋ ๊ฑธ๋ฆฝ๋๋ค
|
| 871 |
""")
|
| 872 |
|
| 873 |
# ๊ฐ์ด๋
|
| 874 |
with gr.Accordion("๐ HeartMuLa ๊ฐ์ด๋", open=False):
|
| 875 |
gr.Markdown(f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 876 |
{HEARTMULA_TAG_GUIDE}
|
| 877 |
|
| 878 |
---
|
|
@@ -885,7 +951,7 @@ with gr.Blocks(css=css, title="๐ต SOMA Music Studio - HeartMuLa") as demo:
|
|
| 885 |
**Paper:** [arXiv](https://arxiv.org/abs/2601.10547) |
|
| 886 |
**Code:** [GitHub](https://github.com/HeartMuLa/heartlib)
|
| 887 |
|
| 888 |
-
*Licensed under
|
| 889 |
""")
|
| 890 |
|
| 891 |
# ========== Event Handlers ==========
|
|
@@ -907,14 +973,14 @@ with gr.Blocks(css=css, title="๐ต SOMA Music Studio - HeartMuLa") as demo:
|
|
| 907 |
# ๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ
|
| 908 |
quick_btn.click(
|
| 909 |
fn=quick_lyrics,
|
| 910 |
-
inputs=[groq_key, theme_input, lyrics_genre, lyrics_mood, lyrics_language,
|
| 911 |
outputs=[final_lyrics]
|
| 912 |
)
|
| 913 |
|
| 914 |
# SOMA ๊ฐ์ฌ ์์ฑ
|
| 915 |
soma_lyrics_btn.click(
|
| 916 |
fn=generate_lyrics_soma,
|
| 917 |
-
inputs=[groq_key, theme_input, lyrics_genre, lyrics_mood, lyrics_language,
|
| 918 |
outputs=[lyrics_status, step1_out, step2_out, step3_out, step4_out]
|
| 919 |
).then(
|
| 920 |
fn=lambda x: x,
|
|
|
|
| 84 |
"[Interlude]", "[Hook]", "[Outro]", "[Inst]", "[Solo]"
|
| 85 |
]
|
| 86 |
|
| 87 |
+
# HeartMuLa ์คํ์ผ ํ๊ทธ ๊ฐ์ด๋ (๋ฐ๋ชจ ํ์ด์ง ๊ธฐ๋ฐ)
|
| 88 |
HEARTMULA_TAG_GUIDE = """
|
| 89 |
+
## ๐ผ HeartMuLa ์
๋ ฅ ํ์
|
| 90 |
|
| 91 |
+
### โ ๏ธ ์ค์: HeartMuLa๋ 2๊ฐ์ง ์
๋ ฅ๋ง ๋ฐ์ต๋๋ค!
|
| 92 |
+
1. **๊ฐ์ฌ (Lyrics)** - ๊ตฌ์กฐ ํ๊ทธ ํฌํจ
|
| 93 |
+
2. **์คํ์ผ ํ๊ทธ (Tags)** - ์ฝค๋ง ๊ตฌ๋ถ, ๊ณต๋ฐฑ ์์
|
| 94 |
|
| 95 |
+
โ ๋ณด์ปฌ ํ์
(๋์ฃ, ๊ทธ๋ฃน ๋ฑ)์ ์ง์ํ์ง ์์ต๋๋ค!
|
| 96 |
+
|
| 97 |
+
### ๐ ๊ตฌ์กฐ ํ๊ทธ (๊ฐ์ฌ ๋ด ์ฌ์ฉ):
|
| 98 |
+
`[Intro]`, `[Verse]`, `[Prechorus]`, `[Chorus]`, `[Bridge]`, `[Outro]`
|
| 99 |
+
|
| 100 |
+
### ๐ท๏ธ ์คํ์ผ ํ๊ทธ ํ์ (์ฝค๋ง ๊ตฌ๋ถ, ๊ณต๋ฐฑ ์์):
|
| 101 |
```
|
| 102 |
piano,happy,wedding,synthesizer,romantic
|
| 103 |
+
energetic,drums,driving,rock,electric guitar
|
| 104 |
+
soft,Sad,Ballad,Longing
|
| 105 |
```
|
| 106 |
|
| 107 |
+
### ๐น ํ๊ทธ ์นดํ
๊ณ ๋ฆฌ (์ค์ ๋ฐ๋ชจ ๊ธฐ๋ฐ):
|
| 108 |
+
|
| 109 |
+
**์
๊ธฐ (Instruments):**
|
| 110 |
+
Piano, Keyboard, synthesizer, drum machine, electric guitar, acoustic guitar, drums, Strings, bass
|
| 111 |
+
|
| 112 |
+
**์ฅ๋ฅด (Genre):**
|
| 113 |
+
pop, R&B, rock, Ballad, electronic, acoustic
|
| 114 |
+
|
| 115 |
+
**๋ถ์๊ธฐ/๊ฐ์ (Mood/Emotion):**
|
| 116 |
+
warm, reflection, energetic, soft, Sad, Regret, Longing, meditation, faith, peaceful, Romantic, emotional, hope, hopeful, powerful, epic, driving, happy, uplifting, dreamy
|
| 117 |
+
|
| 118 |
+
**์ํฉ (Situation):**
|
| 119 |
+
Cafe, wedding, Walking, self-discovery
|
| 120 |
+
|
| 121 |
+
### ๐ ์ง์ ์ธ์ด:
|
| 122 |
+
๐บ๐ธ English | ๐ฐ๐ท Korean | ๐จ๐ณ Chinese | ๐ฏ๐ต Japanese | ๐ช๐ธ Spanish
|
| 123 |
"""
|
| 124 |
|
| 125 |
# HeartMuLa ๊ถ์ฅ ๊ฐ์ฌ ๊ตฌ์กฐ
|
|
|
|
| 207 |
|
| 208 |
EXAMPLE_TAGS = "piano,happy,uplifting,pop"
|
| 209 |
|
| 210 |
+
# ์์ ํ๋กฌํํธ (ํ๊ทธ ์ธํธ) - HeartMuLa ๋ฐ๋ชจ ๊ธฐ๋ฐ
|
| 211 |
EXAMPLE_TAG_PRESETS = {
|
| 212 |
+
"โ Cafe Warm Pop": "warm,reflection,pop,Cafe",
|
| 213 |
+
"๐น R&B Soft Regret": "R&B,Keyboard,Regret,drum machine,electric guitar,synthesizer,soft",
|
| 214 |
+
"โก Electronic Energetic": "energetic,electronic,synthesizer,drum machine,self-discovery",
|
| 215 |
+
"๐ข Sad Ballad Longing": "soft,Sad,Ballad,Longing",
|
| 216 |
+
"๐ง Meditation Peaceful": "meditation,faith,acoustic,peaceful",
|
| 217 |
+
"๐ Wedding Romantic": "wedding,Piano,Strings,acoustic guitar,pop,Romantic",
|
| 218 |
+
"๐ Emotional Piano": "Sad,Regret,electric guitar,drums,Piano,emotional",
|
| 219 |
+
"๐ถ Hopeful Acoustic": "Walking,acoustic guitar,Strings,hope,hopeful",
|
| 220 |
+
"๐ธ Epic Electronic": "synthesizer,drum machine,powerful,epic,Keyboard,electronic",
|
| 221 |
+
"๐ฅ Driving Rock": "energetic,drums,driving,rock,electric guitar",
|
| 222 |
+
"๐ต Happy Uplifting": "piano,happy,uplifting,pop",
|
| 223 |
+
"๐ Soft Dreamy": "soft,dreamy,piano,strings,peaceful"
|
| 224 |
}
|
| 225 |
|
| 226 |
|
|
|
|
| 304 |
OUTPUT ONLY CLEAN LYRICS WITH OPTIMAL TAG STRUCTURE IN THE ORIGINAL LANGUAGE."""
|
| 305 |
}
|
| 306 |
|
| 307 |
+
# ํ๊ทธ ์์ฑ ์์ด์ ํธ - HeartMuLa ๋ฐ๋ชจ ํ๊ทธ ๊ธฐ๋ฐ
|
| 308 |
+
TAG_AGENT = f"""You are a style tag generator for HeartMuLa music generation.
|
| 309 |
|
| 310 |
+
HeartMuLa uses comma-separated tags WITHOUT spaces.
|
| 311 |
+
|
| 312 |
+
VALID TAG CATEGORIES (from official demo):
|
| 313 |
+
|
| 314 |
+
**Instruments:**
|
| 315 |
+
Piano, Keyboard, synthesizer, drum machine, electric guitar, acoustic guitar, drums, Strings, bass
|
| 316 |
+
|
| 317 |
+
**Genre:**
|
| 318 |
+
pop, R&B, rock, Ballad, electronic, acoustic
|
| 319 |
|
| 320 |
+
**Mood/Emotion:**
|
| 321 |
+
warm, reflection, energetic, soft, Sad, Regret, Longing, meditation, faith, peaceful, Romantic, emotional, hope, hopeful, powerful, epic, driving, happy, uplifting, dreamy
|
| 322 |
+
|
| 323 |
+
**Situation:**
|
| 324 |
+
Cafe, wedding, Walking, self-discovery
|
| 325 |
|
| 326 |
RULES:
|
| 327 |
+
1. Output 4-6 tags, comma-separated, NO SPACES between tags
|
| 328 |
+
2. Use ONLY tags from the categories above
|
| 329 |
+
3. Match the requested genre and mood
|
|
|
|
| 330 |
|
| 331 |
+
OUTPUT FORMAT (examples):
|
| 332 |
+
piano,happy,uplifting,pop
|
| 333 |
+
warm,reflection,pop,Cafe
|
| 334 |
+
energetic,drums,driving,rock,electric guitar
|
| 335 |
+
soft,Sad,Ballad,Longing
|
| 336 |
|
| 337 |
Output ONLY the comma-separated tags, nothing else."""
|
| 338 |
|
|
|
|
| 431 |
@spaces.GPU(duration=120)
|
| 432 |
def generate_lyrics_soma(
|
| 433 |
api_key: str, theme: str, genre: str, mood: str,
|
| 434 |
+
language: str, additional: str,
|
| 435 |
progress=gr.Progress()
|
| 436 |
):
|
| 437 |
"""SOMA ๊ฐ์ฌ ์์ฑ"""
|
|
|
|
| 445 |
- Genre: {genre}
|
| 446 |
- Mood: {mood}
|
| 447 |
- Language: {language} โ CRITICAL: You MUST write ALL lyrics in {language} language!
|
|
|
|
| 448 |
{f'- Additional: {additional}' if additional else ''}
|
| 449 |
|
| 450 |
โ ๏ธ LANGUAGE REQUIREMENT: Write the ENTIRE lyrics in {language}!
|
| 451 |
+
{"- ๋ฐ๋์ ํ๊ตญ์ด๋ก ๊ฐ์ฌ๋ฅผ ์์ฑํ์ธ์! ํ๊ธ๋ก๋ง ์์ฑ!" if language == "Korean" else ""}
|
| 452 |
+
{"- ่ฏท็จไธญๆๅๆๆๆญ่ฏ๏ผๅฟ
้กปๅ
จ้จ็จไธญๆ๏ผ" if language == "Chinese" else ""}
|
| 453 |
+
{"- ๆฅๆฌ่ชใงๆญ่ฉใๆธใใฆใใ ใใ๏ผๅ
จใฆๆฅๆฌ่ชใง๏ผ" if language == "Japanese" else ""}
|
| 454 |
+
{"- ยกEscribe toda la letra en espaรฑol! ยกSolo en espaรฑol!" if language == "Spanish" else ""}
|
| 455 |
|
| 456 |
USE HeartMuLa STRUCTURE TAGS:
|
| 457 |
[Intro], [Verse], [Prechorus], [Chorus], [Bridge], [Interlude], [Hook], [Outro]
|
|
|
|
| 487 |
return f"โ {emotional}", draft, structured, "", ""
|
| 488 |
|
| 489 |
progress(0.8, desc="โจ ์ต์ข
ํธ์ง...")
|
| 490 |
+
lang_instruction = {
|
| 491 |
+
"Korean": "ํ๊ตญ์ด๋ก๋ง ์ถ๋ ฅํ์ธ์!",
|
| 492 |
+
"Chinese": "็จไธญๆ่พๅบ๏ผ",
|
| 493 |
+
"Japanese": "ๆฅๆฌ่ชใงๅบๅใใฆใใ ใใ๏ผ",
|
| 494 |
+
"Spanish": "ยกEscribe en espaรฑol!"
|
| 495 |
+
}.get(language, "")
|
| 496 |
final = call_groq(api_key, LYRICS_AGENTS["final_editor"],
|
| 497 |
+
f"Output ONLY clean lyrics in {language}. Use [Prechorus] not [Pre Chorus]! {lang_instruction}", emotional)
|
| 498 |
if final.startswith("Error:"):
|
| 499 |
return f"โ {final}", draft, structured, emotional, ""
|
| 500 |
|
|
|
|
| 508 |
|
| 509 |
|
| 510 |
@spaces.GPU(duration=60)
|
| 511 |
+
def quick_lyrics(api_key: str, theme: str, genre: str, mood: str, language: str, additional: str):
|
| 512 |
"""๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ"""
|
| 513 |
if not api_key or not api_key.strip():
|
| 514 |
return "โ API Key ํ์"
|
|
|
|
| 520 |
- Genre: {genre}
|
| 521 |
- Mood: {mood}
|
| 522 |
- Language: {language} โ CRITICAL: Write ALL lyrics in {language}!
|
|
|
|
| 523 |
{f'- Special: {additional}' if additional else ''}
|
| 524 |
|
| 525 |
โ ๏ธ LANGUAGE: You MUST write the ENTIRE lyrics in {language}!
|
| 526 |
+
{"๋ฐ๋์ ํ๊ตญ์ด๋ก ์์ฑํ์ธ์! ํ๊ธ ๊ฐ์ฌ๋ง!" if language == "Korean" else ""}
|
| 527 |
+
{"่ฏท็จไธญๆๅๆญ่ฏ๏ผ" if language == "Chinese" else ""}
|
| 528 |
+
{"ๆฅๆฌ่ชใงๆธใใฆใใ ใใ๏ผ" if language == "Japanese" else ""}
|
| 529 |
+
{"ยกEscribe en espaรฑol!" if language == "Spanish" else ""}
|
| 530 |
|
| 531 |
USE STRUCTURE (8-10 sections):
|
| 532 |
[Intro] โ [Verse] โ [Prechorus] โ [Chorus] โ [Verse] โ [Prechorus] โ [Chorus] โ [Bridge] โ [Chorus] โ [Outro]
|
|
|
|
| 549 |
|
| 550 |
|
| 551 |
@spaces.GPU(duration=60)
|
| 552 |
+
def generate_tags_ai(api_key: str, genre: str, mood: str, current_tags: str):
|
| 553 |
+
"""AI ํ๊ทธ ์์ฑ - HeartMuLa ํ์"""
|
| 554 |
if not api_key:
|
| 555 |
return "piano,happy,pop"
|
| 556 |
|
| 557 |
+
prompt = f"""Generate HeartMuLa style tags based on:
|
| 558 |
- Genre: {genre}
|
| 559 |
- Mood: {mood}
|
| 560 |
+
- Current hint: {current_tags}
|
| 561 |
+
|
| 562 |
+
Use ONLY these tag categories (from HeartMuLa demo):
|
| 563 |
+
- Instruments: Piano, Keyboard, synthesizer, drum machine, electric guitar, acoustic guitar, drums, Strings, bass
|
| 564 |
+
- Genre: pop, R&B, rock, Ballad, electronic, acoustic
|
| 565 |
+
- Mood: warm, reflection, energetic, soft, Sad, Regret, Longing, meditation, faith, peaceful, Romantic, emotional, hope, hopeful, powerful, epic, driving, happy, uplifting, dreamy
|
| 566 |
+
- Situation: Cafe, wedding, Walking, self-discovery
|
| 567 |
|
| 568 |
+
Output 4-6 comma-separated tags WITHOUT spaces between tags.
|
| 569 |
+
Example: piano,happy,uplifting,pop,Romantic"""
|
| 570 |
|
| 571 |
try:
|
| 572 |
result = call_groq(api_key, TAG_AGENT, prompt)
|
|
|
|
| 815 |
|
| 816 |
with gr.Row():
|
| 817 |
lyrics_language = gr.Dropdown(
|
| 818 |
+
label="๐ ์ธ์ด (Language)",
|
| 819 |
+
choices=["English", "Korean", "Chinese", "Japanese", "Spanish"],
|
| 820 |
+
value="English",
|
| 821 |
+
info="HeartMuLa ๊ณต์ ์ง์ 5๊ฐ ์ธ์ด"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
)
|
| 823 |
|
| 824 |
lyrics_additional = gr.Textbox(
|
| 825 |
label="โจ ์ถ๊ฐ ์ง์ (์ ํ)",
|
| 826 |
+
placeholder="ํน๋ณ ์์ฒญ: ํน์ ๊ฐ์ , ์คํ์ผ ๋ฑ...",
|
| 827 |
lines=1
|
| 828 |
)
|
| 829 |
|
|
|
|
| 907 |
### ๐ก Tips
|
| 908 |
- **๊ตฌ์กฐ ํ๊ทธ:** [Intro], [Verse], [Prechorus], [Chorus], [Bridge], [Outro]
|
| 909 |
- **์คํ์ผ ํ๊ทธ:** piano,happy,uplifting,pop (์ฝค๋ง ๊ตฌ๋ถ, ๊ณต๋ฐฑ ์์!)
|
| 910 |
+
- **์ง์ ์ธ์ด:** ๐บ๐ธ EN | ๐ฐ๐ท KO | ๐จ๐ณ ZH | ๐ฏ๐ต JA | ๐ช๐ธ ES
|
| 911 |
+
- โ ๏ธ **๋ณด์ปฌ ํ์
(๋์ฃ, ๊ทธ๋ฃน ๋ฑ)์ ์ง์ํ์ง ์์ต๋๋ค!**
|
| 912 |
- **Temperature:** ๋์ผ๋ฉด ์ฐฝ์์ , ๋ฎ์ผ๋ฉด ์ผ๊ด์ฑ
|
|
|
|
| 913 |
""")
|
| 914 |
|
| 915 |
# ๊ฐ์ด๋
|
| 916 |
with gr.Accordion("๐ HeartMuLa ๊ฐ์ด๋", open=False):
|
| 917 |
gr.Markdown(f"""
|
| 918 |
+
## โ ๏ธ HeartMuLa ์
๋ ฅ ํ์ (์ค์!)
|
| 919 |
+
|
| 920 |
+
HeartMuLa๋ **2๊ฐ์ง ์
๋ ฅ๋ง** ๋ฐ์ต๋๋ค:
|
| 921 |
+
1. **๊ฐ์ฌ (Lyrics)** - ๊ตฌ์กฐ ํ๊ทธ ํฌํจ
|
| 922 |
+
2. **์คํ์ผ ํ๊ทธ (Tags)** - ์ฝค๋ง ๊ตฌ๋ถ
|
| 923 |
+
|
| 924 |
+
โ **์ง์ํ์ง ์๋ ๊ฒ:**
|
| 925 |
+
- ๋ณด์ปฌ ํ์
์ ํ (๋์ฃ, ๊ทธ๋ฃน, ์ฝ๋ฌ์ค ๋ฑ)
|
| 926 |
+
- ๋ ํผ๋ฐ์ค ์ค๋์ค (์์ง ๋ฏธ์ง์)
|
| 927 |
+
- BPM/ํ
ํฌ ์ง์ ์ง์
|
| 928 |
+
|
| 929 |
+
---
|
| 930 |
+
|
| 931 |
+
## ๐ ์ง์ ์ธ์ด (5๊ฐ)
|
| 932 |
+
| ์ธ์ด | ์ฝ๋ | ์ํ |
|
| 933 |
+
|------|------|------|
|
| 934 |
+
| ๐บ๐ธ English | EN | โ
|
|
| 935 |
+
| ๐ฐ๐ท Korean | KO | โ
|
|
| 936 |
+
| ๐จ๐ณ Chinese | ZH | โ
|
|
| 937 |
+
| ๐ฏ๐ต Japanese | JA | โ
|
|
| 938 |
+
| ๐ช๐ธ Spanish | ES | โ
|
|
| 939 |
+
|
| 940 |
+
---
|
| 941 |
+
|
| 942 |
{HEARTMULA_TAG_GUIDE}
|
| 943 |
|
| 944 |
---
|
|
|
|
| 951 |
**Paper:** [arXiv](https://arxiv.org/abs/2601.10547) |
|
| 952 |
**Code:** [GitHub](https://github.com/HeartMuLa/heartlib)
|
| 953 |
|
| 954 |
+
*Licensed under CC BY-NC 4.0 (Non-Commercial)*
|
| 955 |
""")
|
| 956 |
|
| 957 |
# ========== Event Handlers ==========
|
|
|
|
| 973 |
# ๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ
|
| 974 |
quick_btn.click(
|
| 975 |
fn=quick_lyrics,
|
| 976 |
+
inputs=[groq_key, theme_input, lyrics_genre, lyrics_mood, lyrics_language, lyrics_additional],
|
| 977 |
outputs=[final_lyrics]
|
| 978 |
)
|
| 979 |
|
| 980 |
# SOMA ๊ฐ์ฌ ์์ฑ
|
| 981 |
soma_lyrics_btn.click(
|
| 982 |
fn=generate_lyrics_soma,
|
| 983 |
+
inputs=[groq_key, theme_input, lyrics_genre, lyrics_mood, lyrics_language, lyrics_additional],
|
| 984 |
outputs=[lyrics_status, step1_out, step2_out, step3_out, step4_out]
|
| 985 |
).then(
|
| 986 |
fn=lambda x: x,
|