Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -94,10 +94,10 @@ def custom_split_text(text: str) -> list:
|
|
94 |
candidate_end = len(words)
|
95 |
chunk_words = words[start:candidate_end]
|
96 |
split_index = None
|
97 |
-
for i in range(len(chunk_words) - 1):
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
if split_index is not None:
|
102 |
candidate_end = start + split_index + 1
|
103 |
chunk_words = words[start:candidate_end]
|
@@ -198,7 +198,7 @@ def tts_streaming(text: str, voice: str = "af_heart", speed: float = 1.0, format
|
|
198 |
if i == 0:
|
199 |
tokens_to_send = [0] + chunk_tokens + [0]
|
200 |
else:
|
201 |
-
tokens_to_send = [
|
202 |
# token_to_send = [0] + chunk_tokens + [0]
|
203 |
|
204 |
# Save the last token of this chunk for the next iteration.
|
@@ -209,7 +209,7 @@ def tts_streaming(text: str, voice: str = "af_heart", speed: float = 1.0, format
|
|
209 |
print(final_token)
|
210 |
|
211 |
# Use the number of tokens to select the appropriate style vector.
|
212 |
-
style_index = len(chunk_tokens) +
|
213 |
if style_index >= len(voices):
|
214 |
style_index = len(voices) - 1 # Fallback if index is out-of-bounds.
|
215 |
ref_s = voices[style_index]
|
|
|
94 |
candidate_end = len(words)
|
95 |
chunk_words = words[start:candidate_end]
|
96 |
split_index = None
|
97 |
+
# for i in range(len(chunk_words) - 1):
|
98 |
+
# if '.' in chunk_words[i]:
|
99 |
+
# split_index = i
|
100 |
+
# break
|
101 |
if split_index is not None:
|
102 |
candidate_end = start + split_index + 1
|
103 |
chunk_words = words[start:candidate_end]
|
|
|
198 |
if i == 0:
|
199 |
tokens_to_send = [0] + chunk_tokens + [0]
|
200 |
else:
|
201 |
+
tokens_to_send = [prev_last_token] + [16] + chunk_tokens + [0]
|
202 |
# token_to_send = [0] + chunk_tokens + [0]
|
203 |
|
204 |
# Save the last token of this chunk for the next iteration.
|
|
|
209 |
print(final_token)
|
210 |
|
211 |
# Use the number of tokens to select the appropriate style vector.
|
212 |
+
style_index = len(chunk_tokens) + 1
|
213 |
if style_index >= len(voices):
|
214 |
style_index = len(voices) - 1 # Fallback if index is out-of-bounds.
|
215 |
ref_s = voices[style_index]
|