INNER CODE UNIT · Python
restart_server_endpoint
devnen/Kitten-TTS-Server · server.py:412
async def restart_server_endpoint():
"""
Triggers an async hot-swap of the TTS model engine.
Returns immediately while the model downloads and loads in the background.
The UI polls /api/model-status to track progress.
"""
logger.info("Request received for /restart_server (Async Model Hot-Swap).")
try:
engine.reload_model_async()
return UpdateStatusResponse(
message="Model reload initiated in background. Poll /api/model-status for progress.",
restart_needed=False,
)
except Exception as e:
logger.error(f"Error initiating model hot-swap: {e}", exc_info=True)
raise HTTPException(
status_code=500,