Add files via upload

This commit is contained in:
erew123 authored and GitHub committed 2024-06-22 16:02:12 +01:00
1 parent f016c6cd90
commit 4cba3af3b5
1 file changed
+11 -1
+11 -1
View File
@@ -650,9 +650,19 @@ async def generate_audio(text, voice, language, temperature, repetition_penalty,
response = model_engine.generate_tts(text, voice, language, temperature, repetition_penalty, speed, pitch, output_file, streaming) response = model_engine.generate_tts(text, voice, language, temperature, repetition_penalty, speed, pitch, output_file, streaming)
# If streaming, then return the generator as-is, otherwise just exhaust it and return # If streaming, then return the generator as-is, otherwise just exhaust it and return
if streaming: if streaming:
return response # Return an async generator that yields from the response
async def stream_response():
async for chunk in response:
yield chunk
return stream_response()
else:
# Exhaust the generator and handle any errors
try:
async for _ in response: async for _ in response:
pass pass
except Exception as e:
print(f"[GEN] Error during audio generation: {str(e)}")
raise
########################### ###########################
#### PREVIEW VOICE API #### #### PREVIEW VOICE API ####