Spaces:
Runtime error
Runtime error
Update TextGen/router.py
Browse files- TextGen/router.py +8 -3
TextGen/router.py
CHANGED
|
@@ -306,10 +306,15 @@ def generate_voice_coqui(message: VoiceMessage = None):
|
|
| 306 |
no_lang_auto_detect=False,
|
| 307 |
agree=True,
|
| 308 |
)
|
| 309 |
-
|
| 310 |
for chunk in result:
|
| 311 |
-
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
|
| 314 |
return StreamingResponse(audio_stream(),media_type="audio/mpeg")
|
| 315 |
@app.post("/generate_song")
|
|
|
|
| 306 |
no_lang_auto_detect=False,
|
| 307 |
agree=True,
|
| 308 |
)
|
| 309 |
+
buffer = b""
|
| 310 |
for chunk in result:
|
| 311 |
+
buffer += chunk
|
| 312 |
+
if len(buffer) > 1024: # Adjust the size as needed
|
| 313 |
+
yield buffer
|
| 314 |
+
buffer = b""
|
| 315 |
+
if buffer: # Send any remaining data
|
| 316 |
+
yield buffer
|
| 317 |
+
|
| 318 |
|
| 319 |
return StreamingResponse(audio_stream(),media_type="audio/mpeg")
|
| 320 |
@app.post("/generate_song")
|