Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -17,10 +17,13 @@ from config.settings import Settings
|
|
| 17 |
|
| 18 |
|
| 19 |
def format_lyrics(text: str) -> str:
|
| 20 |
-
"""Format lyrics: bold section markers,
|
|
|
|
| 21 |
# Bold section markers like [Verse 1], [Chorus], etc.
|
| 22 |
text = re.sub(r'\[([^\]]+)\]', r'**[\1]**', text)
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def main():
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
def format_lyrics(text: str) -> str:
|
| 20 |
+
"""Format lyrics: bold section markers, force line breaks."""
|
| 21 |
+
text = text.strip()
|
| 22 |
# Bold section markers like [Verse 1], [Chorus], etc.
|
| 23 |
text = re.sub(r'\[([^\]]+)\]', r'**[\1]**', text)
|
| 24 |
+
# Force markdown line breaks: add two trailing spaces before each newline
|
| 25 |
+
text = re.sub(r' *\n', ' \n', text)
|
| 26 |
+
return text
|
| 27 |
|
| 28 |
|
| 29 |
def main():
|