f5tts/wwwroot/api/inference/index.dspy

16 lines
312 B
Plaintext
Raw Permalink Normal View History

2024-12-19 16:50:53 +08:00
async def g():
async for d in infer_stream(params_kw.prompt):
nd = d.get('audio')
if nd:
yield nd
try:
resp = await stream_response(request, g, content_type='audio/mpeg')
return resp
except Exception as e:
exc = format_exc()
exception(f'{e=}\n{exc}')
return {
"status":"error",
"message":str(e)
}