Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -197,7 +197,7 @@ def tts_streaming(text: str, voice: str = "af_heart", speed: float = 1.0, format
|
|
197 |
if i == 0:
|
198 |
tokens_to_send = [0] + chunk_tokens
|
199 |
else:
|
200 |
-
tokens_to_send = [0] +
|
201 |
# token_to_send = [0] + chunk_tokens
|
202 |
|
203 |
# Save the last token of this chunk for the next iteration.
|
@@ -228,7 +228,7 @@ def tts_streaming(text: str, voice: str = "af_heart", speed: float = 1.0, format
|
|
228 |
except Exception as e:
|
229 |
print(f"Error processing chunk {i}: {e}")
|
230 |
# In case of error, generate a short silent chunk.
|
231 |
-
audio_output = np.zeros((
|
232 |
|
233 |
# Convert the model output (assumed to be float32 in [-1, 1]) to int16 PCM.
|
234 |
audio_int16 = (audio_output * 32767).astype(np.int16).flatten()
|
|
|
197 |
if i == 0:
|
198 |
tokens_to_send = [0] + chunk_tokens
|
199 |
else:
|
200 |
+
tokens_to_send = [0] + prev_last_token + [16] + chunk_tokens
|
201 |
# token_to_send = [0] + chunk_tokens
|
202 |
|
203 |
# Save the last token of this chunk for the next iteration.
|
|
|
228 |
except Exception as e:
|
229 |
print(f"Error processing chunk {i}: {e}")
|
230 |
# In case of error, generate a short silent chunk.
|
231 |
+
audio_output = np.zeros((24000,), dtype=np.float32)
|
232 |
|
233 |
# Convert the model output (assumed to be float32 in [-1, 1]) to int16 PCM.
|
234 |
audio_int16 = (audio_output * 32767).astype(np.int16).flatten()
|