error handling

This commit is contained in:
Jai Suphavadeeprasit 2025-12-29 20:23:58 -05:00
parent 9e53076a82
commit 80f67f979a
4 changed files with 38 additions and 1 deletions

View file

@ -344,6 +344,14 @@ async def info():
@app.get("/batch")
async def get_batch():
# Check if trainer has registered first
if not hasattr(app.state, "started"):
return {
"status": "error",
"message": "Trainer not registered. Call /register first.",
"batch": [],
}
if not app.state.started:
app.state.started = True