rahul7star commited on
Commit
ee61b54
·
verified ·
1 Parent(s): 1526f1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -16
app.py CHANGED
@@ -144,25 +144,29 @@ def get_supported_languages_display() -> str:
144
  """
145
 
146
  def format_for_singing(lyrics: str) -> str:
147
- return f"""
148
- You are a playful children's song singer.
149
- Do NOT speak normally.
150
- Perform this rhythmically and melodically like a song.
151
-
152
- Rules:
153
- - Stretch vowels
154
- - Follow rhythm
155
- - Pause between lines
156
- - Raise pitch on questions
157
- - Sound playful and musical
 
 
 
 
 
 
 
158
 
159
- Start with a soft humming intro:
160
- hmm-hmm-hmm ♪
161
 
162
- Lyrics (sing line by line):
163
 
164
- {lyrics}
165
- """
166
 
167
  DEVICE = "cpu"
168
  MODEL = None
 
144
  """
145
 
146
  def format_for_singing(lyrics: str) -> str:
147
+ """
148
+ Encode melody directly into text for Chatterbox.
149
+ NO instructions. ONLY singable text.
150
+ """
151
+ lines = []
152
+ for line in lyrics.splitlines():
153
+ line = line.strip()
154
+ if not line:
155
+ continue
156
+
157
+ # simple vowel stretching
158
+ line = (
159
+ line.replace("a", "aa")
160
+ .replace("e", "ee")
161
+ .replace("i", "ii")
162
+ .replace("o", "oo")
163
+ .replace("u", "uu")
164
+ )
165
 
166
+ lines.append(f"{line} ...")
 
167
 
168
+ return "\n".join(lines)
169
 
 
 
170
 
171
  DEVICE = "cpu"
172
  MODEL = None