Spaces:
Runtime error
Runtime error
Update TextGen/router.py
Browse files- TextGen/router.py +5 -16
TextGen/router.py
CHANGED
|
@@ -310,23 +310,12 @@ def generate_voice_coqui(message: VoiceMessage = None):
|
|
| 310 |
no_lang_auto_detect=False,
|
| 311 |
agree=True,
|
| 312 |
)
|
| 313 |
-
|
| 314 |
for chunk in result:
|
| 315 |
-
print("received : ",
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
with io.BytesIO() as wav_buffer:
|
| 320 |
-
with wave.open(wav_buffer, 'wb') as wav_file:
|
| 321 |
-
wav_file.setnchannels(1) # Mono channel
|
| 322 |
-
wav_file.setsampwidth(2) # Sample width in bytes (2 bytes for int16)
|
| 323 |
-
wav_file.setframerate(sample_rate)
|
| 324 |
-
wav_file.writeframes(audio_data.astype(np.int16).tobytes())
|
| 325 |
-
|
| 326 |
-
wav_buffer.seek(0)
|
| 327 |
-
yield wav_buffer.read()
|
| 328 |
-
|
| 329 |
-
return StreamingResponse(audio_stream(), media_type="audio/wav")
|
| 330 |
@app.post("/generate_song")
|
| 331 |
@app.get("/generate_song")
|
| 332 |
async def generate_song(request:SongRequest,httprequest: Request):
|
|
|
|
| 310 |
no_lang_auto_detect=False,
|
| 311 |
agree=True,
|
| 312 |
)
|
| 313 |
+
# Generate the audio stream from ElevenLabs
|
| 314 |
for chunk in result:
|
| 315 |
+
print("received : ",chunk)
|
| 316 |
+
yield chunk#
|
| 317 |
+
|
| 318 |
+
return StreamingResponse(audio_stream(),media_type="audio/mpeg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
@app.post("/generate_song")
|
| 320 |
@app.get("/generate_song")
|
| 321 |
async def generate_song(request:SongRequest,httprequest: Request):
|