Spaces:
Running
on
L40S
Running
on
L40S
update info
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import json
|
|
3 |
from datetime import datetime
|
4 |
import yaml
|
5 |
import time
|
|
|
6 |
import os.path as op
|
7 |
from download import download_model
|
8 |
|
@@ -64,6 +65,7 @@ def generate_song(lyric, description=None, prompt_audio=None, genre=None, cfg_co
|
|
64 |
sample_rate = MODEL.cfg.sample_rate
|
65 |
|
66 |
# 适配lyric格式
|
|
|
67 |
lyric = lyric.replace("[intro]", "[intro-short]").replace("[inst]", "[inst-short]").replace("[outro]", "[outro-short]")
|
68 |
lyric = lyric.replace("\n\n", " ; ")
|
69 |
for s in STRUCTS:
|
@@ -111,7 +113,7 @@ with gr.Blocks(title="SongGeration Demo Space") as demo:
|
|
111 |
lines=5,
|
112 |
max_lines=15,
|
113 |
value=EXAMPLE_LYRICS,
|
114 |
-
info="
|
115 |
placeholder="""Lyric Format
|
116 |
'''
|
117 |
[structure tag]
|
@@ -120,22 +122,10 @@ lyrics
|
|
120 |
[structure tag]
|
121 |
lyrics
|
122 |
'''
|
123 |
-
1. One paragraph represents one
|
124 |
-
2. One line represents one
|
125 |
-
3.
|
126 |
-
|
127 |
-
- '[chorus]'
|
128 |
-
- '[bridge]'
|
129 |
-
- '[intro-short]'
|
130 |
-
- '[intro-medium]'
|
131 |
-
- '[intro-long]'
|
132 |
-
- '[outro-short]'
|
133 |
-
- '[outro-medium]'
|
134 |
-
- '[outro-long]'
|
135 |
-
- '[inst-short]'
|
136 |
-
- '[inst-medium]'
|
137 |
-
- '[inst-long]'
|
138 |
-
- '[silence]'
|
139 |
"""
|
140 |
)
|
141 |
|
|
|
3 |
from datetime import datetime
|
4 |
import yaml
|
5 |
import time
|
6 |
+
import re
|
7 |
import os.path as op
|
8 |
from download import download_model
|
9 |
|
|
|
65 |
sample_rate = MODEL.cfg.sample_rate
|
66 |
|
67 |
# 适配lyric格式
|
68 |
+
lyric = re.sub(r"[,。!?,!?:]", "", lyric)
|
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:
|
|
|
113 |
lines=5,
|
114 |
max_lines=15,
|
115 |
value=EXAMPLE_LYRICS,
|
116 |
+
info="Each paragraph represents a segment starting with a structure tag and ending with a blank line, each line is a sentence without punctuation, segments [intro], [inst], [outro] should not contain lyrics, while [verse], [chorus], and [bridge] require lyrics.",
|
117 |
placeholder="""Lyric Format
|
118 |
'''
|
119 |
[structure tag]
|
|
|
122 |
[structure tag]
|
123 |
lyrics
|
124 |
'''
|
125 |
+
1. One paragraph represents one segments, starting with a structure tag and ending with a blank line
|
126 |
+
2. One line represents one sentence, punctuation is not recommended inside the sentence
|
127 |
+
3. The following segments should not contain lyrics: [intro-short] , [intro-medium] , [inst-short] , [inst-medium] , [outro-short] , [outro-medium]
|
128 |
+
4. The following segments require lyrics: [verse] , [chorus] , [bridge]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
"""
|
130 |
)
|
131 |
|