Spaces:
Running
on
L40S
Running
on
L40S
hainazhu
commited on
Commit
·
208580f
1
Parent(s):
f08442b
modify app.py for test
Browse files
app.py
CHANGED
@@ -12,6 +12,11 @@ APP_DIR = op.dirname(op.abspath(__file__))
|
|
12 |
from download import download_model
|
13 |
# 下载模型
|
14 |
download_model(APP_DIR)
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
EXAMPLE_DESC = """female, dark, pop, sad, piano and drums, the bpm is 125."""
|
17 |
EXAMPLE_LYRICS = """
|
@@ -52,6 +57,7 @@ R&B的节奏奏响.
|
|
52 |
|
53 |
# 模拟歌曲生成函数
|
54 |
def generate_song(description, lyric, prompt_audio=None):
|
|
|
55 |
# 这里模拟生成过程 - 实际应用中替换为你的模型调用
|
56 |
print(f"Generating song with description: {description}")
|
57 |
print(f"Lyrics provided: {lyric}")
|
@@ -69,6 +75,7 @@ def generate_song(description, lyric, prompt_audio=None):
|
|
69 |
"lyric": lyric,
|
70 |
"has_prompt_audio": prompt_audio is not None,
|
71 |
"timestamp": datetime.now().isoformat(),
|
|
|
72 |
}
|
73 |
|
74 |
return (sample_rate, audio_data), json.dumps(input_config, indent=2)
|
|
|
12 |
from download import download_model
|
13 |
# 下载模型
|
14 |
download_model(APP_DIR)
|
15 |
+
print("Successful downloaded model.")
|
16 |
+
|
17 |
+
from levo_inference import LeVoInference
|
18 |
+
|
19 |
+
model = LeVoInference(op.join(APP_DIR, "conf/infer.yaml"))
|
20 |
|
21 |
EXAMPLE_DESC = """female, dark, pop, sad, piano and drums, the bpm is 125."""
|
22 |
EXAMPLE_LYRICS = """
|
|
|
57 |
|
58 |
# 模拟歌曲生成函数
|
59 |
def generate_song(description, lyric, prompt_audio=None):
|
60 |
+
global model
|
61 |
# 这里模拟生成过程 - 实际应用中替换为你的模型调用
|
62 |
print(f"Generating song with description: {description}")
|
63 |
print(f"Lyrics provided: {lyric}")
|
|
|
75 |
"lyric": lyric,
|
76 |
"has_prompt_audio": prompt_audio is not None,
|
77 |
"timestamp": datetime.now().isoformat(),
|
78 |
+
"model": str(model),
|
79 |
}
|
80 |
|
81 |
return (sample_rate, audio_data), json.dumps(input_config, indent=2)
|