bcci commited on
Commit
d352468
·
verified ·
1 Parent(s): aacce8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -192,19 +192,20 @@ def tts_streaming(text: str, voice: str = "af_heart", speed: float = 1.0, format
192
  for i, chunk in enumerate(chunks):
193
  # Convert the chunk text to tokens.
194
  chunk_tokens = tokenizer(chunk)
 
195
 
196
  # For the first chunk, prepend 0; for later chunks, start with the previous chunk's last token.
197
- if i == 0:
198
- tokens_to_send = [0] + chunk_tokens + [0]
199
- else:
200
- # tokens_to_send = [prev_last_token] + [0] + chunk_tokens
201
- token_to_send = [0] + chunk_tokens + [0]
202
 
203
  # Save the last token of this chunk for the next iteration.
204
- prev_last_token = tokens_to_send[-1]
205
 
206
  # Prepare the model input (a batch of one sequence).
207
- final_token = [tokens_to_send]
208
 
209
  # Use the number of tokens to select the appropriate style vector.
210
  style_index = len(tokens_to_send)
 
192
  for i, chunk in enumerate(chunks):
193
  # Convert the chunk text to tokens.
194
  chunk_tokens = tokenizer(chunk)
195
+ print(chunk)
196
 
197
  # For the first chunk, prepend 0; for later chunks, start with the previous chunk's last token.
198
+ # if i == 0:
199
+ # tokens_to_send = [0] + chunk_tokens + [0]
200
+ # else:
201
+ # # tokens_to_send = [prev_last_token] + [0] + chunk_tokens
202
+ # token_to_send = [0] + chunk_tokens + [0]
203
 
204
  # Save the last token of this chunk for the next iteration.
205
+ # prev_last_token = tokens_to_send[-1]
206
 
207
  # Prepare the model input (a batch of one sequence).
208
+ final_token = [[0, *chunk_tokens, 0]]
209
 
210
  # Use the number of tokens to select the appropriate style vector.
211
  style_index = len(tokens_to_send)