INNER CODE UNIT · Python
cancel_loading_endpoint
devnen/Kitten-TTS-Server · server.py:435
async def cancel_loading_endpoint():
"""Cancels any in-progress model loading."""
logger.info("Request received for /api/cancel-loading.")
cancelled = engine.cancel_loading()
if cancelled:
return {"message": "Model loading cancellation requested."}
return {"message": "No model loading in progress."}
@app.post("/api/unload", tags=["Configuration"])
async def unload_model_endpoint():
"""
Unloads the TTS model and releases all resources.
The model will need to be reloaded (via /restart_server) before TTS requests can be processed.
"""
logger.info("Request received for /api/unload (Model Unload).")
try:
success = engine.unload_model()