seawolf2357 commited on
Commit
2531687
ยท
verified ยท
1 Parent(s): 58e36e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +129 -63
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 Tag Format Guide
90
 
91
- ### STRUCTURE TAGS (๊ฐ€์‚ฌ ๋‚ด ์‚ฌ์šฉ):
92
- [Intro], [Verse], [Prechorus], [Chorus], [Bridge], [Interlude], [Hook], [Outro], [Inst], [Solo]
 
93
 
94
- ### STYLE TAGS FORMAT (์ฝค๋งˆ ๊ตฌ๋ถ„, ๊ณต๋ฐฑ ์—†์Œ):
 
 
 
 
 
95
  ```
96
  piano,happy,wedding,synthesizer,romantic
97
- guitar,sad,ballad,strings,emotional
98
- drums,energetic,rock,electric_guitar,powerful
99
  ```
100
 
101
- ### RECOMMENDED TAG CATEGORIES:
102
- **Instruments:** piano,guitar,drums,bass,synthesizer,strings,violin,cello,trumpet,saxophone,flute,harp,organ
103
- **Mood:** happy,sad,romantic,energetic,calm,melancholic,uplifting,dark,dreamy,nostalgic,powerful,peaceful
104
- **Genre:** pop,rock,jazz,classical,electronic,folk,blues,r&b,hip_hop,disco,ballad,cinematic
105
- **Tempo:** fast,slow,moderate,upbeat,relaxed
 
 
 
 
 
 
 
 
 
 
 
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
- "๐ŸŽน Piano Ballad": "piano,ballad,emotional,romantic,slow",
196
- "๐ŸŽธ Rock Energetic": "guitar,drums,rock,energetic,powerful,fast",
197
- "๐ŸŽท Jazz Smooth": "piano,saxophone,jazz,smooth,relaxed,romantic",
198
- "๐ŸŽต K-Pop Dance": "synthesizer,drums,bass,kpop,energetic,upbeat,pop",
199
- "๐ŸŒ™ Lo-Fi Chill": "piano,guitar,lofi,calm,dreamy,relaxed",
200
- "๐ŸŽป Orchestral Epic": "strings,orchestra,cinematic,epic,powerful,dramatic",
201
- "๐Ÿชฉ Disco Funk": "bass,drums,synthesizer,disco,funky,upbeat,dance",
202
- "๐ŸŒฟ Folk Acoustic": "guitar,folk,acoustic,calm,peaceful,warm",
203
- "๐Ÿ’ซ Electronic Dance": "synthesizer,drums,electronic,energetic,dance,upbeat",
204
- "๐Ÿ˜ข Sad Melancholic": "piano,strings,sad,melancholic,slow,emotional",
205
- "๐ŸŽ‰ Happy Uplifting": "piano,happy,uplifting,pop,bright,joyful",
206
- "๐ŸŒ… Wedding Romantic": "piano,happy,wedding,synthesizer,romantic"
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
- {HEARTMULA_TAG_GUIDE}
 
 
 
 
 
 
 
 
294
 
295
- Your task: Generate OPTIMIZED comma-separated tags (NO SPACES between tags).
 
 
 
 
296
 
297
  RULES:
298
- 1. Tags must be comma-separated WITHOUT spaces: tag1,tag2,tag3
299
- 2. Use lowercase with underscores for multi-word: electric_guitar, hip_hop
300
- 3. Include 5-8 tags covering: instrument, mood, genre, tempo
301
- 4. Be specific: "piano" not "keyboard", "guitar" not "strings"
302
 
303
- OUTPUT FORMAT (example):
304
- piano,synthesizer,happy,pop,upbeat,romantic
 
 
 
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, vocal_type: str, additional: 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
- {"- ๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด๋กœ ๊ฐ€์‚ฌ๋ฅผ ์ž‘์„ฑํ•˜์„ธ์š”! ์˜์–ด ๋‹จ์–ด๋Š” ์ตœ์†Œํ™”ํ•˜๊ณ  ํ•œ๊ธ€๋กœ ์ž‘์„ฑ!" if language == "Korean" else ""}
422
- {"- ํ•œ๊ตญ์–ด์™€ ์˜์–ด๋ฅผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์„ž์–ด์„œ ์ž‘์„ฑํ•˜์„ธ์š”." if language == "Korean + English" else ""}
 
 
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]! {'ํ•œ๊ตญ์–ด๋กœ๋งŒ ์ถœ๋ ฅํ•˜์„ธ์š”!' if language == 'Korean' else ''}", emotional)
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, vocal_type: str, additional: 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
- {"๋ฐ˜๋“œ์‹œ ํ•œ๊ตญ์–ด๋กœ ์ž‘์„ฑํ•˜์„ธ์š”! ํ•œ๊ธ€ ๊ฐ€์‚ฌ๋งŒ ์ž‘์„ฑ!" if language == "Korean" else ""}
490
- {"ํ•œ๊ตญ์–ด์™€ ์˜์–ด๋ฅผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์„ž์–ด์„œ ์ž‘์„ฑํ•˜์„ธ์š”." if language == "Korean + English" else ""}
 
 
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, instruments: 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
- - Instruments hint: {instruments}
 
 
 
 
 
 
522
 
523
- Output 5-8 comma-separated tags WITHOUT spaces.
524
- Example: piano,synthesizer,happy,pop,upbeat"""
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", "Korean + English", "Japanese"],
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 Apache 2.0*
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, lyrics_vocal_type, lyrics_additional],
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, lyrics_vocal_type, lyrics_additional],
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,