MCPcopy Create free account
hub / github.com/SunOner/sunone_aimbot / api_train

Function api_train

helper_api.py:1291–1308  ·  view source on GitHub ↗
(payload: TrainRequest)

Source from the content-addressed store, hash-verified

1289
1290@app.post("/api/train")
1291def api_train(payload: TrainRequest) -> dict[str, Any]:
1292 script, env_overrides = _train_script_and_env(payload)
1293 raw_output = "".join(
1294 _stream_python_script(
1295 script,
1296 "Training completed.",
1297 "Training failed.",
1298 env_overrides=env_overrides,
1299 )
1300 )
1301 output, status = _split_stream_result(raw_output)
1302 if not status or status.get("ok") is False:
1303 raise HTTPException(
1304 status_code=500,
1305 detail={"message": (status or {}).get("message", "Training failed."), "output": output},
1306 )
1307 _invalidate_system_meta_cache()
1308 return {"ok": True, "message": status.get("message", "Training completed."), "output": output}
1309
1310
1311@app.post("/api/train/stream")

Callers

nothing calls this directly

Calls 4

_train_script_and_envFunction · 0.85
_stream_python_scriptFunction · 0.85
_split_stream_resultFunction · 0.85

Tested by

no test coverage detected