INNER CODE UNIT · Python
openai_speech_endpoint
devnen/Kitten-TTS-Server · server.py:687
async def openai_speech_endpoint(request: OpenAISpeechRequest):
# Check if the TTS model is loaded
if not engine.MODEL_LOADED:
raise HTTPException(
status_code=503,
detail="TTS engine model is not currently loaded or available.",
)
try:
# Synthesize the audio
audio_np, sr = engine.synthesize(
text=request.input_,
voice=request.voice,
speed=request.speed,
)
if audio_np is None or sr is None:
raise HTTPException(