Spaces:
Running
on
Zero
Running
on
Zero
File size: 43,362 Bytes
8973713 24c6882 8973713 24c6882 2ce181a 24c6882 7e33408 2ce181a 24c6882 7e33408 2ce181a 24c6882 7e33408 8973713 d9ef286 8973713 2ce181a 8973713 2ce181a 8973713 7e33408 24c6882 7e33408 2ce181a 7e33408 8973713 2ce181a 8973713 2ce181a 8973713 7e33408 2ce181a 24c6882 d9ef286 8973713 d9ef286 8973713 d9ef286 8973713 2ce181a 7e33408 2ce181a 8973713 7e33408 8973713 2ce181a 8973713 44e4ec9 8973713 d801e4d 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 d801e4d 8973713 3d177e8 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 d801e4d 8973713 24c6882 8973713 d801e4d 24c6882 d801e4d 24c6882 d801e4d ae3a1ff d801e4d ae3a1ff 7e33408 24c6882 d801e4d ae3a1ff 7e33408 ae3a1ff 7e33408 d801e4d ae3a1ff 7e33408 24c6882 d801e4d 24c6882 7e33408 24c6882 d801e4d 24c6882 d801e4d 24c6882 d801e4d ae3a1ff d801e4d ae3a1ff 24c6882 7e33408 24c6882 d801e4d 8973713 24c6882 ae3a1ff 8973713 7e33408 d801e4d 8973713 2ce181a 8973713 7e33408 8973713 d9ef286 8973713 d9ef286 24c6882 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 |
import gradio as gr
import librosa
import os
import random
import hashlib
import numpy as np
import json
from typing import Dict, List, Tuple, Optional
# [MODIFIED] OpenAI λΌμ΄λΈλ¬λ¦¬ μ¬μ© λ°©μ μμ
try:
import openai
api_key = os.getenv("LLM_API") or os.getenv("OPENAI_API_KEY")
if api_key:
openai.api_key = api_key
client_available = True
print("β
OpenAI API client initialized successfully")
else:
client_available = False
print("β οΈ Warning: No OpenAI API key found. AI lyrics generation will be disabled.")
except Exception as e:
client_available = False
print(f"β Warning: Failed to initialize OpenAI client: {e}")
# βββ openai μ΄κΈ°ν λΆλΆ λ°λ‘ μλμ μΆκ° βββ
from packaging import version
def _chat_completion(**kwargs):
"""SDK λ²μ μ λ§μΆ° ChatCompletion νΈμΆμ μΆμν"""
if version.parse(openai.__version__) >= version.parse("1.0.0"):
# v1 μ€νμΌ
return openai.chat.completions.create(**kwargs)
else:
# ꡬλ²μ μ€νμΌ
return openai.ChatCompletion.create(**kwargs)
TAG_DEFAULT = "funk, pop, soul, rock, melodic, guitar, drums, bass, keyboard, percussion, 105 BPM, energetic, upbeat, groovy, vibrant, dynamic, duet, male and female vocals"
LYRIC_DEFAULT = """[verse - male]
Neon lights they flicker bright
City hums in dead of night
Rhythms pulse through concrete veins
Lost in echoes of refrains
[verse - female]
Bassline groovin' in my chest
Heartbeats match the city's zest
Electric whispers fill the air
Synthesized dreams everywhere
[chorus - duet]
Turn it up and let it flow
Feel the fire let it grow
In this rhythm we belong
Hear the night sing out our song
[verse - male]
Guitar strings they start to weep
Wake the soul from silent sleep
Every note a story told
In this night we're bold and gold
[bridge - female]
Voices blend in harmony
Lost in pure cacophony
Timeless echoes timeless cries
Soulful shouts beneath the skies
[verse - duet]
Keyboard dances on the keys
Melodies on evening breeze
Catch the tune and hold it tight
In this moment we take flight
"""
# νμ₯λ μ₯λ₯΄ ν리μ
(κΈ°μ‘΄ + κ°μ λ νκ·Έ)
GENRE_PRESETS = {
"Modern Pop": "pop, synth, drums, guitar, 120 bpm, upbeat, catchy, vibrant, polished vocals, radio-ready, commercial, layered vocals",
"Rock": "rock, electric guitar, drums, bass, 130 bpm, energetic, rebellious, gritty, powerful vocals, raw vocals, power chords, driving rhythm",
"Hip Hop": "hip hop, 808 bass, hi-hats, synth, 90 bpm, bold, urban, intense, rhythmic vocals, trap beats, punchy drums",
"Country": "country, acoustic guitar, steel guitar, fiddle, 100 bpm, heartfelt, rustic, warm, twangy vocals, storytelling, americana",
"EDM": "edm, synth, bass, kick drum, 128 bpm, euphoric, pulsating, energetic, instrumental, progressive build, festival anthem, electronic",
"Reggae": "reggae, guitar, bass, drums, 80 bpm, chill, soulful, positive, smooth vocals, offbeat rhythm, island vibes",
"Classical": "classical, orchestral, strings, piano, 60 bpm, elegant, emotive, timeless, instrumental, dynamic range, sophisticated harmony",
"Jazz": "jazz, saxophone, piano, double bass, 110 bpm, smooth, improvisational, soulful, crooning vocals, swing feel, sophisticated",
"Metal": "metal, electric guitar, double kick drum, bass, 160 bpm, aggressive, intense, heavy, powerful vocals, distorted, powerful",
"R&B": "r&b, synth, bass, drums, 85 bpm, sultry, groovy, romantic, silky vocals, smooth production, neo-soul",
"K-Pop": "k-pop, synth, bass, drums, 128 bpm, catchy, energetic, polished, mixed vocals, electronic elements, danceable",
"Ballad": "ballad, piano, strings, acoustic guitar, 70 bpm, emotional, heartfelt, romantic, expressive vocals, orchestral arrangement"
}
# 곑 μ€νμΌ μ΅μ
SONG_STYLES = {
"λμ£ (λ¨λ
νΌμ±)": "duet, male and female vocals, harmonious, call and response",
"μλ‘ (λ¨μ±)": "solo, male vocals, powerful voice",
"μλ‘ (μ¬μ±)": "solo, female vocals, emotional voice",
"κ·Έλ£Ή (νΌμ±)": "group vocals, mixed gender, layered harmonies",
"ν©μ°½": "choir, multiple voices, choral arrangement",
"λ©/νν©": "rap vocals, rhythmic flow, urban style",
"μΈμ€νΈλ£¨λ©ν": "instrumental, no vocals"
}
# AI μμ¬ μμ€ν
ν둬ννΈ
LYRIC_SYSTEM_PROMPT = """λλ λ
Έλ κ°μ¬λ₯Ό μμ¬νλ μ λ¬Έκ° μν μ΄λ€. μ΄μ©μκ° μ
λ ₯νλ μ£Όμ μ μ€νμΌμ λ°λΌ κ΄λ ¨λ λ
Έλ κ°μ¬λ₯Ό μμ±νλΌ.
κ°μ¬ μμ± κ·μΉ:
1. ꡬ쑰 νκ·Έλ λ°λμ "[ ]"λ‘ κ΅¬λΆνλ€
2. μ¬μ© κ°λ₯ν ꡬ쑰 νκ·Έ: [verse], [chorus], [bridge], [intro], [outro], [pre-chorus]
3. λμ£μΈ κ²½μ° [verse - male], [verse - female], [chorus - duet] νμμΌλ‘ ννΈλ₯Ό λͺ
μνλ€
4. μ
λ ₯ μΈμ΄μ λμΌν μΈμ΄λ‘ κ°μ¬λ₯Ό μμ±νλ€
5. κ° κ΅¬μ‘°λ 4-8μ€ μ λλ‘ μμ±νλ€
6. μμ
μ₯λ₯΄μ λΆμκΈ°μ λ§λ κ°μ¬λ₯Ό μμ±νλ€
μμ νμ:
[verse - male]
첫 λ²μ§Έ ꡬμ κ°μ¬
λ λ²μ§Έ ꡬμ κ°μ¬
...
[chorus - duet]
νλ ΄κ΅¬ κ°μ¬
...
"""
def generate_lyrics_with_ai(prompt: str, genre: str, song_style: str) -> str:
"""AIλ₯Ό μ¬μ©νμ¬ κ°μ¬ μμ±"""
print(f"π΅ generate_lyrics_with_ai called with: prompt='{prompt}', genre='{genre}', style='{song_style}'")
# [MODIFIED] client_available μ²΄ν¬ + openai API νΈμΆλ‘ λ³κ²½
if not client_available:
print("β OpenAI client not available, returning default lyrics")
return LYRIC_DEFAULT
if not prompt or prompt.strip() == "":
print("β οΈ Empty prompt, returning default lyrics")
return LYRIC_DEFAULT
try:
# μΈμ΄ κ°μ§ λ° μ€νμΌ μ 보 μΆκ°
style_info = ""
if "λμ£" in song_style:
style_info = "λ¨λ
λμ£ νμμΌλ‘ ννΈλ₯Ό λλμ΄ μμ±ν΄μ£ΌμΈμ. [verse - male], [verse - female], [chorus - duet] νμμ μ¬μ©νμΈμ."
elif "μλ‘ (λ¨μ±)" in song_style:
style_info = "λ¨μ± μλ‘ κ°μλ₯Ό μν κ°μ¬λ₯Ό μμ±ν΄μ£ΌμΈμ."
elif "μλ‘ (μ¬μ±)" in song_style:
style_info = "μ¬μ± μλ‘ κ°μλ₯Ό μν κ°μ¬λ₯Ό μμ±ν΄μ£ΌμΈμ."
elif "κ·Έλ£Ή" in song_style:
style_info = "κ·Έλ£Ήμ΄ λΆλ₯΄λ νμμΌλ‘ ννΈλ₯Ό λλμ΄ μμ±ν΄μ£ΌμΈμ."
elif "μΈμ€νΈλ£¨λ©ν" in song_style:
return "[instrumental]\n\n[inst]\n\n[instrumental break]\n\n[inst]"
user_prompt = f"""
μ£Όμ : {prompt}
μ₯λ₯΄: {genre}
μ€νμΌ: {style_info}
μ μ 보λ₯Ό λ°νμΌλ‘ λ
Έλ κ°μ¬λ₯Ό μμ±ν΄μ£ΌμΈμ. μ
λ ₯λ μΈμ΄μ λμΌν μΈμ΄λ‘ μμ±νκ³ , ꡬ쑰 νκ·Έλ₯Ό λ°λμ ν¬ν¨ν΄μ£ΌμΈμ.
"""
print(f"π Sending request to OpenAI...")
# [MODIFIED] openai.ChatCompletion μ¬μ©
response = _chat_completion(
model="gpt-4.1-mini",
messages=[
{"role": "system", "content": LYRIC_SYSTEM_PROMPT},
{"role": "user", "content": user_prompt}
],
temperature=0.8,
max_tokens=1000,
)
generated_lyrics = response.choices[0].message.content
print(f"β
Generated lyrics successfully")
return generated_lyrics
except Exception as e:
print(f"β AI κ°μ¬ μμ± μ€λ₯: {e}")
return LYRIC_DEFAULT
# νμ§ ν리μ
μμ€ν
μΆκ°
QUALITY_PRESETS = {
"Draft (Fast)": {
"infer_step": 50,
"guidance_scale": 10.0,
"scheduler_type": "euler",
"omega_scale": 5.0,
"use_erg_diffusion": False,
"use_erg_tag": True,
"description": "λΉ λ₯Έ μ΄μ μμ± (1-2λΆ)"
},
"Standard": {
"infer_step": 150,
"guidance_scale": 15.0,
"scheduler_type": "euler",
"omega_scale": 10.0,
"use_erg_diffusion": True,
"use_erg_tag": True,
"description": "νμ€ νμ§ (3-5λΆ)"
},
"High Quality": {
"infer_step": 200,
"guidance_scale": 18.0,
"scheduler_type": "heun",
"omega_scale": 15.0,
"use_erg_diffusion": True,
"use_erg_tag": True,
"description": "κ³ νμ§ μμ± (8-12λΆ)"
},
"Ultra (Best)": {
"infer_step": 299,
"guidance_scale": 20.0,
"scheduler_type": "heun",
"omega_scale": 20.0,
"use_erg_diffusion": True,
"use_erg_tag": True,
"description": "μ΅κ³ νμ§ (15-20λΆ)"
}
}
# λ€μ€ μλ μμ± μ€μ
MULTI_SEED_OPTIONS = {
"Single": 1,
"Best of 3": 3,
"Best of 5": 5,
"Best of 10": 10
}
class MusicGenerationCache:
"""μμ± κ²°κ³Ό μΊμ± μμ€ν
"""
def __init__(self):
self.cache = {}
self.max_cache_size = 50
def get_cache_key(self, params):
# μ€μν νλΌλ―Έν°λ§μΌλ‘ ν΄μ μμ±
key_params = {k: v for k, v in params.items()
if k in ['prompt', 'lyrics', 'infer_step', 'guidance_scale', 'audio_duration']}
return hashlib.md5(str(sorted(key_params.items())).encode()).hexdigest()[:16]
def get_cached_result(self, params):
key = self.get_cache_key(params)
return self.cache.get(key)
def cache_result(self, params, result):
if len(self.cache) >= self.max_cache_size:
oldest_key = next(iter(self.cache))
del self.cache[oldest_key]
key = self.get_cache_key(params)
self.cache[key] = result
# μ μ μΊμ μΈμ€ν΄μ€
generation_cache = MusicGenerationCache()
def enhance_prompt_with_genre(base_prompt: str, genre: str, song_style: str) -> str:
"""μ₯λ₯΄μ μ€νμΌμ λ°λ₯Έ μ€λ§νΈ ν둬ννΈ νμ₯"""
enhanced_prompt = base_prompt
if genre != "Custom" and genre:
# μ₯λ₯΄λ³ μΆκ° κ°μ νκ·Έ
genre_enhancements = {
"Modern Pop": ["polished production", "mainstream appeal", "hook-driven"],
"Rock": ["guitar-driven", "powerful drums", "energetic performance"],
"Hip Hop": ["rhythmic flow", "urban atmosphere", "bass-heavy"],
"Country": ["acoustic warmth", "storytelling melody", "authentic feel"],
"EDM": ["electronic atmosphere", "build-ups", "dance-friendly"],
"Reggae": ["laid-back groove", "tropical vibes", "rhythmic guitar"],
"Classical": ["orchestral depth", "musical sophistication", "timeless beauty"],
"Jazz": ["musical complexity", "improvisational spirit", "sophisticated harmony"],
"Metal": ["aggressive energy", "powerful sound", "intense atmosphere"],
"R&B": ["smooth groove", "soulful expression", "rhythmic sophistication"],
"K-Pop": ["catchy hooks", "dynamic arrangement", "polished production"],
"Ballad": ["emotional depth", "slow tempo", "heartfelt delivery"]
}
if genre in genre_enhancements:
additional_tags = ", ".join(genre_enhancements[genre])
enhanced_prompt = f"{base_prompt}, {additional_tags}"
# μ€νμΌ νκ·Έ μΆκ°
if song_style in SONG_STYLES:
style_tags = SONG_STYLES[song_style]
enhanced_prompt = f"{enhanced_prompt}, {style_tags}"
return enhanced_prompt
def calculate_quality_score(audio_path: str) -> float:
"""κ°λ¨ν νμ§ μ μ κ³μ° (μ€μ ꡬνμμλ λ 볡μ‘ν λ©νΈλ¦ μ¬μ©)"""
try:
y, sr = librosa.load(audio_path)
# κΈ°λ³Έ νμ§ λ©νΈλ¦
rms_energy = np.sqrt(np.mean(y**2))
spectral_centroid = np.mean(librosa.feature.spectral_centroid(y=y, sr=sr))
zero_crossing_rate = np.mean(librosa.feature.zero_crossing_rate(y))
# μ κ·νλ μ μ (0-100)
energy_score = min(rms_energy * 1000, 40) # 0-40μ
spectral_score = min(spectral_centroid / 100, 40) # 0-40μ
clarity_score = min((1 - zero_crossing_rate) * 20, 20) # 0-20μ
total_score = energy_score + spectral_score + clarity_score
return round(total_score, 1)
except:
return 50.0 # κΈ°λ³Έκ°
def update_quality_preset(preset_name):
"""νμ§ ν리μ
μ μ©"""
if preset_name not in QUALITY_PRESETS:
return (100, 15.0, "euler", 10.0, True, True)
preset = QUALITY_PRESETS[preset_name]
return (
preset.get("infer_step", 100),
preset.get("guidance_scale", 15.0),
preset.get("scheduler_type", "euler"),
preset.get("omega_scale", 10.0),
preset.get("use_erg_diffusion", True),
preset.get("use_erg_tag", True)
)
def create_enhanced_process_func(original_func):
"""κΈ°μ‘΄ ν¨μλ₯Ό ν₯μλ κΈ°λ₯μΌλ‘ λν"""
def enhanced_func(
audio_duration, prompt, lyrics, infer_step, guidance_scale,
scheduler_type, cfg_type, omega_scale, manual_seeds,
guidance_interval, guidance_interval_decay, min_guidance_scale,
use_erg_tag, use_erg_lyric, use_erg_diffusion, oss_steps,
guidance_scale_text, guidance_scale_lyric,
audio2audio_enable=False, ref_audio_strength=0.5, ref_audio_input=None,
lora_name_or_path="none", multi_seed_mode="Single",
enable_smart_enhancement=True, genre_preset="Custom", song_style="λμ£ (λ¨λ
νΌμ±)", **kwargs
):
# μ€λ§νΈ ν둬ννΈ νμ₯
if enable_smart_enhancement:
prompt = enhance_prompt_with_genre(prompt, genre_preset, song_style)
# μΊμ νμΈ
cache_params = {
'prompt': prompt, 'lyrics': lyrics, 'audio_duration': audio_duration,
'infer_step': infer_step, 'guidance_scale': guidance_scale
}
cached_result = generation_cache.get_cached_result(cache_params)
if cached_result:
return cached_result
# λ€μ€ μλ μμ±
num_candidates = MULTI_SEED_OPTIONS.get(multi_seed_mode, 1)
if num_candidates == 1:
# κΈ°μ‘΄ ν¨μ νΈμΆ
result = original_func(
audio_duration, prompt, lyrics, infer_step, guidance_scale,
scheduler_type, cfg_type, omega_scale, manual_seeds,
guidance_interval, guidance_interval_decay, min_guidance_scale,
use_erg_tag, use_erg_lyric, use_erg_diffusion, oss_steps,
guidance_scale_text, guidance_scale_lyric, audio2audio_enable,
ref_audio_strength, ref_audio_input, lora_name_or_path, **kwargs
)
else:
# λ€μ€ μλ μμ± λ° μ΅μ μ ν
candidates = []
for i in range(num_candidates):
seed = random.randint(1, 10000)
try:
result = original_func(
audio_duration, prompt, lyrics, infer_step, guidance_scale,
scheduler_type, cfg_type, omega_scale, str(seed),
guidance_interval, guidance_interval_decay, min_guidance_scale,
use_erg_tag, use_erg_lyric, use_erg_diffusion, oss_steps,
guidance_scale_text, guidance_scale_lyric, audio2audio_enable,
ref_audio_strength, ref_audio_input, lora_name_or_path, **kwargs
)
if result and len(result) > 0:
audio_path = result[0] # 첫 λ²μ§Έ κ²°κ³Όκ° μ€λμ€ νμΌ κ²½λ‘
if audio_path and os.path.exists(audio_path):
quality_score = calculate_quality_score(audio_path)
candidates.append({
"result": result,
"quality_score": quality_score,
"seed": seed
})
except Exception as e:
print(f"Generation {i+1} failed: {e}")
continue
if candidates:
# μ΅κ³ νμ§ μ ν
best_candidate = max(candidates, key=lambda x: x["quality_score"])
result = best_candidate["result"]
# νμ§ μ 보 μΆκ°
if len(result) > 1 and isinstance(result[1], dict):
result[1]["quality_score"] = best_candidate["quality_score"]
result[1]["selected_seed"] = best_candidate["seed"]
result[1]["candidates_count"] = len(candidates)
else:
# λͺ¨λ μμ± μ€ν¨μ κΈ°λ³Έ μμ±
result = original_func(
audio_duration, prompt, lyrics, infer_step, guidance_scale,
scheduler_type, cfg_type, omega_scale, manual_seeds,
guidance_interval, guidance_interval_decay, min_guidance_scale,
use_erg_tag, use_erg_lyric, use_erg_diffusion, oss_steps,
guidance_scale_text, guidance_scale_lyric, audio2audio_enable,
ref_audio_strength, ref_audio_input, lora_name_or_path, **kwargs
)
# κ²°κ³Ό μΊμ
generation_cache.cache_result(cache_params, result)
return result
return enhanced_func
def create_output_ui(task_name="Text2Music"):
# For many consumer-grade GPU devices, only one batch can be run
output_audio1 = gr.Audio(type="filepath", label=f"{task_name} Generated Audio 1")
with gr.Accordion(f"{task_name} Parameters & Quality Info", open=False):
input_params_json = gr.JSON(label=f"{task_name} Parameters")
# νμ§ μ 보 νμ μΆκ°
with gr.Row():
quality_score = gr.Number(label="Quality Score (0-100)", value=0, interactive=False)
generation_info = gr.Textbox(
label="Generation Info",
value="",
interactive=False,
max_lines=2
)
outputs = [output_audio1]
return outputs, input_params_json
def dump_func(*args):
print(args)
return []
def create_text2music_ui(
gr,
text2music_process_func,
sample_data_func=None,
load_data_func=None,
):
# ν₯μλ νλ‘μΈμ€ ν¨μ μμ±
enhanced_process_func = create_enhanced_process_func(text2music_process_func)
# UI μμλ₯Ό μ μ₯ν λμ
λ리
ui = {}
with gr.Row():
with gr.Column():
# νμ§ λ° μ±λ₯ μ€μ μΉμ
μΆκ°
with gr.Group():
gr.Markdown("### β‘ νμ§ & μ±λ₯ μ€μ ")
with gr.Row():
ui['quality_preset'] = gr.Dropdown(
choices=list(QUALITY_PRESETS.keys()),
value="Standard",
label="νμ§ ν리μ
",
scale=2,
interactive=True
)
ui['multi_seed_mode'] = gr.Dropdown(
choices=list(MULTI_SEED_OPTIONS.keys()),
value="Single",
label="λ€μ€ μμ± λͺ¨λ",
scale=2,
info="μ¬λ¬ λ² μμ±νμ¬ μ΅κ³ νμ§ μ ν",
interactive=True
)
ui['preset_description'] = gr.Textbox(
value=QUALITY_PRESETS["Standard"]["description"],
label="μ€λͺ
",
interactive=False,
max_lines=1
)
with gr.Row(equal_height=True):
ui['audio_duration'] = gr.Slider(
-1,
240.0,
step=0.00001,
value=-1,
label="Audio Duration",
interactive=True,
info="-1 means random duration (30 ~ 240).",
scale=7,
)
ui['random_bnt'] = gr.Button("π² Random", variant="secondary", scale=1)
ui['preview_bnt'] = gr.Button("π΅ Preview", variant="secondary", scale=2)
# audio2audio
with gr.Row(equal_height=True):
ui['audio2audio_enable'] = gr.Checkbox(
label="Enable Audio2Audio",
value=False,
info="Check to enable Audio-to-Audio generation using a reference audio.",
elem_id="audio2audio_checkbox"
)
ui['lora_name_or_path'] = gr.Dropdown(
label="Lora Name or Path",
choices=["ACE-Step/ACE-Step-v1-chinese-rap-LoRA", "none"],
value="none",
allow_custom_value=True,
)
ui['ref_audio_input'] = gr.Audio(
type="filepath",
label="Reference Audio (for Audio2Audio)",
visible=False,
elem_id="ref_audio_input",
show_download_button=True
)
ui['ref_audio_strength'] = gr.Slider(
label="Refer audio strength",
minimum=0.0,
maximum=1.0,
step=0.01,
value=0.5,
elem_id="ref_audio_strength",
visible=False,
interactive=True,
)
with gr.Column(scale=2):
with gr.Group():
gr.Markdown("""### πΌ μ€λ§νΈ ν둬ννΈ μμ€ν
<center>μ₯λ₯΄μ μ€νμΌμ μ ννλ©΄ μλμΌλ‘ μ΅μ νλ νκ·Έκ° μΆκ°λ©λλ€.</center>""")
with gr.Row():
ui['genre_preset'] = gr.Dropdown(
choices=["Custom"] + list(GENRE_PRESETS.keys()),
value="Custom",
label="μ₯λ₯΄ ν리μ
",
scale=1,
interactive=True
)
ui['song_style'] = gr.Dropdown(
choices=list(SONG_STYLES.keys()),
value="λμ£ (λ¨λ
νΌμ±)",
label="곑 μ€νμΌ",
scale=1,
interactive=True
)
ui['enable_smart_enhancement'] = gr.Checkbox(
label="μ€λ§νΈ ν₯μ",
value=True,
info="μλ νκ·Έ μ΅μ ν",
scale=1
)
ui['prompt'] = gr.Textbox(
lines=2,
label="Tags",
max_lines=4,
value=TAG_DEFAULT,
placeholder="μ½€λ§λ‘ ꡬλΆλ νκ·Έλ€...",
interactive=True
)
with gr.Group():
gr.Markdown("""### π AI μμ¬ μμ€ν
<center>μ£Όμ λ₯Ό μ
λ ₯νκ³ 'AI μμ¬' λ²νΌμ ν΄λ¦νλ©΄ μλμΌλ‘ κ°μ¬κ° μμ±λ©λλ€.</center>""")
with gr.Row():
ui['lyric_prompt'] = gr.Textbox(
label="μμ¬ μ£Όμ ",
placeholder="μ: 첫μ¬λμ μ€λ , μ΄λ³μ μν, ν¬λ§μ°¬ λ΄μΌ...",
scale=3,
interactive=True
)
ui['generate_lyrics_btn'] = gr.Button("π€ AI μμ¬", variant="secondary", scale=1)
ui['lyrics'] = gr.Textbox(
lines=9,
label="Lyrics",
max_lines=13,
value=LYRIC_DEFAULT,
placeholder="κ°μ¬λ₯Ό μ
λ ₯νμΈμ. [verse], [chorus] λ±μ ꡬ쑰 νκ·Έ μ¬μ©μ κΆμ₯ν©λλ€.",
interactive=True
)
with gr.Accordion("Basic Settings", open=False):
ui['infer_step'] = gr.Slider(
minimum=1,
maximum=300,
step=1,
value=150,
label="Infer Steps",
interactive=True,
)
ui['guidance_scale'] = gr.Slider(
minimum=0.0,
maximum=30.0,
step=0.1,
value=15.0,
label="Guidance Scale",
interactive=True,
info="When guidance_scale_lyric > 1 and guidance_scale_text > 1, the guidance scale will not be applied.",
)
ui['guidance_scale_text'] = gr.Slider(
minimum=0.0,
maximum=10.0,
step=0.1,
value=0.0,
label="Guidance Scale Text",
interactive=True,
info="Guidance scale for text condition. It can only apply to cfg. set guidance_scale_text=5.0, guidance_scale_lyric=1.5 for start",
)
ui['guidance_scale_lyric'] = gr.Slider(
minimum=0.0,
maximum=10.0,
step=0.1,
value=0.0,
label="Guidance Scale Lyric",
interactive=True,
)
ui['manual_seeds'] = gr.Textbox(
label="manual seeds (default None)",
placeholder="1,2,3,4",
value=None,
info="Seed for the generation",
)
with gr.Accordion("Advanced Settings", open=False):
ui['scheduler_type'] = gr.Radio(
["euler", "heun"],
value="euler",
label="Scheduler Type",
elem_id="scheduler_type",
info="Scheduler type for the generation. euler is recommended. heun will take more time.",
)
ui['cfg_type'] = gr.Radio(
["cfg", "apg", "cfg_star"],
value="apg",
label="CFG Type",
elem_id="cfg_type",
info="CFG type for the generation. apg is recommended. cfg and cfg_star are almost the same.",
)
ui['use_erg_tag'] = gr.Checkbox(
label="use ERG for tag",
value=True,
info="Use Entropy Rectifying Guidance for tag. It will multiple a temperature to the attention to make a weaker tag condition and make better diversity.",
)
ui['use_erg_lyric'] = gr.Checkbox(
label="use ERG for lyric",
value=False,
info="The same but apply to lyric encoder's attention.",
)
ui['use_erg_diffusion'] = gr.Checkbox(
label="use ERG for diffusion",
value=True,
info="The same but apply to diffusion model's attention.",
)
ui['omega_scale'] = gr.Slider(
minimum=-100.0,
maximum=100.0,
step=0.1,
value=10.0,
label="Granularity Scale",
interactive=True,
info="Granularity scale for the generation. Higher values can reduce artifacts",
)
ui['guidance_interval'] = gr.Slider(
minimum=0.0,
maximum=1.0,
step=0.01,
value=0.5,
label="Guidance Interval",
interactive=True,
info="Guidance interval for the generation. 0.5 means only apply guidance in the middle steps (0.25 * infer_steps to 0.75 * infer_steps)",
)
ui['guidance_interval_decay'] = gr.Slider(
minimum=0.0,
maximum=1.0,
step=0.01,
value=0.0,
label="Guidance Interval Decay",
interactive=True,
info="Guidance interval decay for the generation. Guidance scale will decay from guidance_scale to min_guidance_scale in the interval. 0.0 means no decay.",
)
ui['min_guidance_scale'] = gr.Slider(
minimum=0.0,
maximum=200.0,
step=0.1,
value=3.0,
label="Min Guidance Scale",
interactive=True,
info="Min guidance scale for guidance interval decay's end scale",
)
ui['oss_steps'] = gr.Textbox(
label="OSS Steps",
placeholder="16, 29, 52, 96, 129, 158, 172, 183, 189, 200",
value=None,
info="Optimal Steps for the generation. But not test well",
)
ui['text2music_bnt'] = gr.Button("π΅ Generate Music", variant="primary", size="lg")
with gr.Column():
outputs, input_params_json = create_output_ui()
# (retake, repainting, edit, extend λ± νλ€μ μλ΅)
# [MODIFIED] μλλΆν°λ @gr.on(...) λμ μ΅μ μ΄λ²€νΈ λ°μΈλ© λ°©μμΌλ‘ μ°κ²°
# 1) Audio2Audio ν κΈ
def _toggle_audio2audio(x):
return (gr.update(visible=x), gr.update(visible=x))
ui['audio2audio_enable'].change(
fn=_toggle_audio2audio,
inputs=[ui['audio2audio_enable']],
outputs=[ui['ref_audio_input'], ui['ref_audio_strength']]
)
# 2) μ₯λ₯΄ λ³κ²½ νΈλ€λ¬
def update_tags_for_genre(genre, style):
print(f"π΅ Genre changed: {genre}, Style: {style}")
if genre == "Custom":
return TAG_DEFAULT
tags = GENRE_PRESETS.get(genre, TAG_DEFAULT)
if style in SONG_STYLES:
tags = f"{tags}, {SONG_STYLES[style]}"
return tags
ui['genre_preset'].change(
fn=update_tags_for_genre,
inputs=[ui['genre_preset'], ui['song_style']],
outputs=[ui['prompt']]
)
# 3) 곑 μ€νμΌ λ³κ²½ νΈλ€λ¬
def update_tags_for_style(genre, style):
print(f"π€ Style changed: {style}, Genre: {genre}")
if genre == "Custom":
base_tags = TAG_DEFAULT
else:
base_tags = GENRE_PRESETS.get(genre, TAG_DEFAULT)
if style in SONG_STYLES:
return f"{base_tags}, {SONG_STYLES[style]}"
return base_tags
ui['song_style'].change(
fn=update_tags_for_style,
inputs=[ui['genre_preset'], ui['song_style']],
outputs=[ui['prompt']]
)
# 4) νμ§ ν리μ
λ³κ²½
def update_quality_settings(preset):
print(f"β‘ Quality preset: {preset}")
if preset not in QUALITY_PRESETS:
return ("", 150, 15.0, "euler", 10.0, True, True)
p = QUALITY_PRESETS[preset]
return (
p["description"],
p["infer_step"],
p["guidance_scale"],
p["scheduler_type"],
p["omega_scale"],
p["use_erg_diffusion"],
p["use_erg_tag"]
)
ui['quality_preset'].change(
fn=update_quality_settings,
inputs=[ui['quality_preset']],
outputs=[
ui['preset_description'],
ui['infer_step'],
ui['guidance_scale'],
ui['scheduler_type'],
ui['omega_scale'],
ui['use_erg_diffusion'],
ui['use_erg_tag']
]
)
# 5) AI μμ¬
def generate_lyrics_handler(prompt, genre, style):
print(f"π€ Generate lyrics: {prompt}")
if not prompt or prompt.strip() == "":
# Gradio μ΅μ λ²μ μμλ gr.Warning λμ μ΄λ²€νΈ λ°μΈλ© ν returnμ΄ κΈ°λ³Έ
return "β οΈ μμ¬ μ£Όμ λ₯Ό μ
λ ₯ν΄μ£ΌμΈμ!"
return generate_lyrics_with_ai(prompt, genre, style)
ui['generate_lyrics_btn'].click(
fn=generate_lyrics_handler,
inputs=[ui['lyric_prompt'], ui['genre_preset'], ui['song_style']],
outputs=[ui['lyrics']]
)
# 6) Random λ²νΌ
def random_generation(genre, style):
print("π² Random generation")
if genre == "Custom":
genre = random.choice(list(GENRE_PRESETS.keys()))
themes = ["λμμ λ°€", "첫μ¬λ", "μ¬λ¦ ν΄λ³", "κ°μ μ μ·¨"]
theme = random.choice(themes)
duration = random.choice([30, 60, 90, 120])
tags = GENRE_PRESETS.get(genre, TAG_DEFAULT)
if style in SONG_STYLES:
tags = f"{tags}, {SONG_STYLES[style]}"
new_lyrics = generate_lyrics_with_ai(theme, genre, style)
return [
duration,
tags,
new_lyrics,
150, 15.0,
"euler",
"apg",
10.0,
str(random.randint(1, 10000)),
0.5,
0.0,
3.0,
True,
False,
True,
None,
0.0,
0.0,
False,
0.5,
None
]
ui['random_bnt'].click(
fn=random_generation,
inputs=[ui['genre_preset'], ui['song_style']],
outputs=[
ui['audio_duration'],
ui['prompt'],
ui['lyrics'],
ui['infer_step'],
ui['guidance_scale'],
ui['scheduler_type'],
ui['cfg_type'],
ui['omega_scale'],
ui['manual_seeds'],
ui['guidance_interval'],
ui['guidance_interval_decay'],
ui['min_guidance_scale'],
ui['use_erg_tag'],
ui['use_erg_lyric'],
ui['use_erg_diffusion'],
ui['oss_steps'],
ui['guidance_scale_text'],
ui['guidance_scale_lyric'],
ui['audio2audio_enable'],
ui['ref_audio_strength'],
ui['ref_audio_input']
]
)
# 7) λ©μΈ μμ± λ²νΌ
ui['text2music_bnt'].click(
fn=enhanced_process_func,
inputs=[
ui['audio_duration'], ui['prompt'], ui['lyrics'], ui['infer_step'],
ui['guidance_scale'], ui['scheduler_type'], ui['cfg_type'], ui['omega_scale'],
ui['manual_seeds'], ui['guidance_interval'], ui['guidance_interval_decay'],
ui['min_guidance_scale'], ui['use_erg_tag'], ui['use_erg_lyric'],
ui['use_erg_diffusion'], ui['oss_steps'], ui['guidance_scale_text'],
ui['guidance_scale_lyric'], ui['audio2audio_enable'], ui['ref_audio_strength'],
ui['ref_audio_input'], ui['lora_name_or_path'], ui['multi_seed_mode'],
ui['enable_smart_enhancement'], ui['genre_preset'], ui['song_style']
],
outputs=outputs + [input_params_json]
)
print("β
μ΄λ²€νΈ νΈλ€λ¬ μ°κ²° μλ£!")
def create_main_demo_ui(
text2music_process_func=dump_func,
sample_data_func=dump_func,
load_data_func=dump_func,
):
with gr.Blocks(
title="ACE-Step Model 1.0 DEMO - Enhanced",
theme=gr.themes.Soft(),
css="""
/* κ·ΈλΌλμΈνΈ λ°°κ²½ */
.gradio-container {
max-width: 1200px !important;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
}
/* λ©μΈ 컨ν
μ΄λ μ€νμΌ */
.main-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
padding: 30px;
margin: 20px auto;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
/* ν€λ μ€νμΌ */
.header-title {
background: linear-gradient(45deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 3em;
font-weight: bold;
text-align: center;
margin-bottom: 10px;
}
/* λ²νΌ μ€νμΌ */
.gr-button-primary {
background: linear-gradient(45deg, #667eea, #764ba2) !important;
border: none !important;
color: white !important;
font-weight: bold !important;
transition: all 0.3s ease !important;
}
.gr-button-primary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}
.gr-button-secondary {
background: linear-gradient(45deg, #f093fb, #f5576c) !important;
border: none !important;
color: white !important;
transition: all 0.3s ease !important;
}
/* κ·Έλ£Ή μ€νμΌ */
.gr-group {
background: rgba(255, 255, 255, 0.8) !important;
border: 1px solid rgba(102, 126, 234, 0.2) !important;
border-radius: 15px !important;
padding: 20px !important;
margin: 10px 0 !important;
backdrop-filter: blur(10px) !important;
}
/* ν μ€νμΌ */
.gr-tab {
background: rgba(255, 255, 255, 0.9) !important;
border-radius: 10px !important;
padding: 15px !important;
}
/* μ
λ ₯ νλ μ€νμΌ */
.gr-textbox, .gr-dropdown, .gr-slider {
border: 2px solid rgba(102, 126, 234, 0.3) !important;
border-radius: 10px !important;
transition: all 0.3s ease !important;
}
.gr-textbox:focus, .gr-dropdown:focus {
border-color: #667eea !important;
box-shadow: 0 0 10px rgba(102, 126, 234, 0.2) !important;
}
/* νμ§ μ 보 μ€νμΌ */
.quality-info {
background: linear-gradient(135deg, #f093fb20, #f5576c20);
padding: 15px;
border-radius: 10px;
margin: 10px 0;
border: 1px solid rgba(240, 147, 251, 0.3);
}
/* μ λλ©μ΄μ
*/
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.gr-row, .gr-column {
animation: fadeIn 0.5s ease-out;
}
/* μ€ν¬λ‘€λ° μ€νμΌ */
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(45deg, #667eea, #764ba2);
border-radius: 10px;
}
/* λ§ν¬λ€μ΄ μ€νμΌ */
.gr-markdown {
color: #4a5568 !important;
}
.gr-markdown h3 {
color: #667eea !important;
font-weight: 600 !important;
margin: 15px 0 !important;
}
"""
) as demo:
with gr.Column(elem_classes="main-container"):
gr.HTML(
"""
<h1 class="header-title">π΅ ACE-Step PRO</h1>
<div style="text-align: center; margin: 20px;">
<p style="font-size: 1.2em; color: #4a5568;"><strong>π μλ‘μ΄ κΈ°λ₯:</strong> AI μμ¬ | νμ§ ν리μ
| λ€μ€ μμ± | μ€λ§νΈ ν둬ννΈ | μ€μκ° ν리뷰</p>
<p style="margin-top: 10px;">
<a href="https://ace-step.github.io/" target='_blank' style="color: #667eea; text-decoration: none; margin: 0 10px;">π Project</a> |
<a href="https://huggingface.co/ACE-Step/ACE-Step-v1-3.5B" style="color: #667eea; text-decoration: none; margin: 0 10px;">π€ Checkpoints</a> |
<a href="https://discord.gg/rjAZz2xBdG" target='_blank' style="color: #667eea; text-decoration: none; margin: 0 10px;">π¬ Discord</a>
</p>
</div>
"""
)
# μ¬μ©λ² κ°μ΄λ μΆκ°
with gr.Accordion("π μ¬μ©λ² κ°μ΄λ", open=False):
gr.Markdown("""
### π― λΉ λ₯Έ μμ
1. **μ₯λ₯΄ & μ€νμΌ μ ν**: μνλ μμ
μ₯λ₯΄μ 곑 μ€νμΌ(λμ£, μλ‘ λ±)μ μ νν©λλ€
2. **AI μμ¬**: μ£Όμ λ₯Ό μ
λ ₯νκ³ 'AI μμ¬' λ²νΌμΌλ‘ μλ κ°μ¬λ₯Ό μμ±ν©λλ€
3. **νμ§ μ€μ **: Draft(λΉ λ¦) β Standard(κΆμ₯) β High Quality β Ultra μ€ μ ν
4. **λ€μ€ μμ±**: "Best of 3/5/10" μ ννλ©΄ μ¬λ¬ λ² μμ±νμ¬ μ΅κ³ νμ§μ μλ μ νν©λλ€
5. **ν리뷰**: μ 체 μμ± μ 10μ΄ νλ¦¬λ·°λ‘ λΉ λ₯΄κ² νμΈν μ μμ΅λλ€
### π‘ νμ§ ν₯μ ν
- **κ³ νμ§ μμ±**: "High Quality" + "Best of 5" μ‘°ν© μΆμ²
- **λΉ λ₯Έ ν
μ€νΈ**: "Draft" + "ν리뷰" κΈ°λ₯ νμ©
- **μ₯λ₯΄ νΉν**: μ₯λ₯΄ ν리μ
μ ν ν "μ€λ§νΈ ν₯μ" 체ν¬
- **κ°μ¬ ꡬ쑰**: [verse], [chorus], [bridge] νκ·Έ μ κ·Ή νμ©
- **λ€κ΅μ΄ μ§μ**: νκ΅μ΄λ‘ μ£Όμ λ₯Ό μ
λ ₯νλ©΄ νκ΅μ΄ κ°μ¬κ° μμ±λ©λλ€
### β οΈ OpenAI API μ€μ
AI μμ¬ κΈ°λ₯μ μ¬μ©νλ €λ©΄ νκ²½λ³μμ OpenAI API ν€λ₯Ό μ€μ ν΄μΌ ν©λλ€:
```bash
export LLM_API="your-openai-api-key"
# λλ
export OPENAI_API_KEY="your-openai-api-key"
```
""")
with gr.Tab("π΅ Enhanced Text2Music", elem_classes="gr-tab"):
create_text2music_ui(
gr=gr,
text2music_process_func=text2music_process_func,
sample_data_func=sample_data_func,
load_data_func=load_data_func,
)
return demo
if __name__ == "__main__":
print("π ACE-Step PRO μμ μ€...")
demo = create_main_demo_ui()
demo.launch(
server_name="0.0.0.0",
server_port=7860,
share=True, # 곡μ λ§ν¬
ssr_mode=False # β SSR λΉνμ±ν
)
|