Spaces:
Running
on
L40S
Running
on
L40S
update lyric preprocess
Browse files
app.py
CHANGED
@@ -65,13 +65,15 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
65 |
sample_rate = MODEL.cfg.sample_rate
|
66 |
|
67 |
# 适配lyric格式
|
68 |
-
lyric = re.sub(r"[
|
|
|
69 |
lyric = lyric.replace("[intro]", "[intro-short]").replace("[inst]", "[inst-short]").replace("[outro]", "[outro-short]")
|
70 |
lyric = lyric.replace("\n\n", " ; ")
|
71 |
for s in STRUCTS:
|
72 |
lyric = lyric.replace(f"{s}\n", f"{s} ")
|
73 |
lyric = lyric.replace("\n", ".")
|
74 |
lyric = lyric.replace(". ; ", " ; ")
|
|
|
75 |
|
76 |
# 适配prompt
|
77 |
if prompt_audio is not None:
|
|
|
65 |
sample_rate = MODEL.cfg.sample_rate
|
66 |
|
67 |
# 适配lyric格式
|
68 |
+
lyric = re.sub(r"[^\w\s\[\]\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af\u00c0-\u017f]", "", lyric)
|
69 |
+
lyric = lyric.lower()
|
70 |
lyric = lyric.replace("[intro]", "[intro-short]").replace("[inst]", "[inst-short]").replace("[outro]", "[outro-short]")
|
71 |
lyric = lyric.replace("\n\n", " ; ")
|
72 |
for s in STRUCTS:
|
73 |
lyric = lyric.replace(f"{s}\n", f"{s} ")
|
74 |
lyric = lyric.replace("\n", ".")
|
75 |
lyric = lyric.replace(". ; ", " ; ")
|
76 |
+
lyric = lyric.replace("].", "] ").replace("..", " ")
|
77 |
|
78 |
# 适配prompt
|
79 |
if prompt_audio is not None:
|