Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,20 @@ import json
|
|
| 4 |
import os
|
| 5 |
from groq import Groq
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# ============================================================
|
| 8 |
# ๐ต SOMA Music Studio - HeartMuLa Optimized Edition
|
| 9 |
# MiniMax Music 2.5 + HeartMuLa Style Guide + Comic Classic Theme
|
|
@@ -499,6 +513,7 @@ def clean_tags(tags: str) -> str:
|
|
| 499 |
return ','.join(unique_tags)
|
| 500 |
|
| 501 |
|
|
|
|
| 502 |
def generate_lyrics_soma(
|
| 503 |
api_key: str, theme: str, genre: str, mood: str,
|
| 504 |
language: str, vocal_type: str, additional: str, progress=gr.Progress()
|
|
@@ -567,6 +582,7 @@ Create lyrics with PERFECT HeartMuLa structure!"""
|
|
| 567 |
return f"โ ์์ธ ๋ฐ์: {str(e)}", "", "", "", ""
|
| 568 |
|
| 569 |
|
|
|
|
| 570 |
def quick_lyrics(api_key: str, theme: str, genre: str, mood: str, language: str, vocal_type: str, additional: str):
|
| 571 |
"""๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ - HeartMuLa ์ต์ ํ"""
|
| 572 |
if not api_key or not api_key.strip():
|
|
@@ -633,6 +649,7 @@ Generate 5-8 relevant tags:"""
|
|
| 633 |
return "piano,happy,pop"
|
| 634 |
|
| 635 |
|
|
|
|
| 636 |
def augment_prompt_soma(
|
| 637 |
api_key: str, user_prompt: str, genre: str, mood: str,
|
| 638 |
tempo: str, vocal_type: str, instruments: str, reference_style: str, progress=gr.Progress()
|
|
@@ -698,6 +715,7 @@ Output ONLY the final prompt paragraph in English."""
|
|
| 698 |
return f"โ ์์ธ ๋ฐ์: {str(e)}", ""
|
| 699 |
|
| 700 |
|
|
|
|
| 701 |
def generate_music(api_key: str, model: str, prompt: str, lyrics: str,
|
| 702 |
sample_rate: int, bitrate: int, audio_format: str):
|
| 703 |
"""MiniMax ์์
์์ฑ (๋ชจ๋ธ 2.5)"""
|
|
|
|
| 4 |
import os
|
| 5 |
from groq import Groq
|
| 6 |
|
| 7 |
+
# Hugging Face Spaces GPU ์ง์ (ZeroGPU ํธํ)
|
| 8 |
+
try:
|
| 9 |
+
import spaces
|
| 10 |
+
SPACES_AVAILABLE = True
|
| 11 |
+
except ImportError:
|
| 12 |
+
SPACES_AVAILABLE = False
|
| 13 |
+
# Dummy decorator for local development
|
| 14 |
+
class spaces:
|
| 15 |
+
@staticmethod
|
| 16 |
+
def GPU(duration=60):
|
| 17 |
+
def decorator(func):
|
| 18 |
+
return func
|
| 19 |
+
return decorator
|
| 20 |
+
|
| 21 |
# ============================================================
|
| 22 |
# ๐ต SOMA Music Studio - HeartMuLa Optimized Edition
|
| 23 |
# MiniMax Music 2.5 + HeartMuLa Style Guide + Comic Classic Theme
|
|
|
|
| 513 |
return ','.join(unique_tags)
|
| 514 |
|
| 515 |
|
| 516 |
+
@spaces.GPU(duration=120)
|
| 517 |
def generate_lyrics_soma(
|
| 518 |
api_key: str, theme: str, genre: str, mood: str,
|
| 519 |
language: str, vocal_type: str, additional: str, progress=gr.Progress()
|
|
|
|
| 582 |
return f"โ ์์ธ ๋ฐ์: {str(e)}", "", "", "", ""
|
| 583 |
|
| 584 |
|
| 585 |
+
@spaces.GPU(duration=60)
|
| 586 |
def quick_lyrics(api_key: str, theme: str, genre: str, mood: str, language: str, vocal_type: str, additional: str):
|
| 587 |
"""๋น ๋ฅธ ๊ฐ์ฌ ์์ฑ - HeartMuLa ์ต์ ํ"""
|
| 588 |
if not api_key or not api_key.strip():
|
|
|
|
| 649 |
return "piano,happy,pop"
|
| 650 |
|
| 651 |
|
| 652 |
+
@spaces.GPU(duration=120)
|
| 653 |
def augment_prompt_soma(
|
| 654 |
api_key: str, user_prompt: str, genre: str, mood: str,
|
| 655 |
tempo: str, vocal_type: str, instruments: str, reference_style: str, progress=gr.Progress()
|
|
|
|
| 715 |
return f"โ ์์ธ ๋ฐ์: {str(e)}", ""
|
| 716 |
|
| 717 |
|
| 718 |
+
@spaces.GPU(duration=180)
|
| 719 |
def generate_music(api_key: str, model: str, prompt: str, lyrics: str,
|
| 720 |
sample_rate: int, bitrate: int, audio_format: str):
|
| 721 |
"""MiniMax ์์
์์ฑ (๋ชจ๋ธ 2.5)"""
|