Jofthomas HF staff commited on
Commit
807a056
·
verified ·
1 Parent(s): 30f89ce

Update TextGen/router.py

Browse files
Files changed (1) hide show
  1. TextGen/router.py +4 -9
TextGen/router.py CHANGED
@@ -306,17 +306,12 @@ def generate_voice_coqui(message: VoiceMessage = None):
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")
321
  @app.get("/generate_song")
322
  async def generate_song(request:SongRequest,httprequest: Request):
 
306
  no_lang_auto_detect=False,
307
  agree=True,
308
  )
309
+ # Generate the audio stream from ElevenLabs
310
  for chunk in result:
311
+ print("received : ",chunk)
312
+ yield chunk#
 
 
 
 
313
 
314
+ return StreamingResponse(audio_stream())
 
315
  @app.post("/generate_song")
316
  @app.get("/generate_song")
317
  async def generate_song(request:SongRequest,httprequest: Request):