(
input_model: str = Form(...),
source_method: str = Form("Default"),
topmost: bool = Form(True),
model_image_size: int = Form(640),
input_device: str = Form("0"),
input_delay: int = Form(30),
resize_factor: int = Form(80),
ai_conf: float = Form(0.20),
video_file: UploadFile | None = File(None),
)
| 1319 | |
| 1320 | @app.post("/api/tests/run") |
| 1321 | async def api_tests( |
| 1322 | input_model: str = Form(...), |
| 1323 | source_method: str = Form("Default"), |
| 1324 | topmost: bool = Form(True), |
| 1325 | model_image_size: int = Form(640), |
| 1326 | input_device: str = Form("0"), |
| 1327 | input_delay: int = Form(30), |
| 1328 | resize_factor: int = Form(80), |
| 1329 | ai_conf: float = Form(0.20), |
| 1330 | video_file: UploadFile | None = File(None), |
| 1331 | ) -> dict[str, Any]: |
| 1332 | script, cleanup_paths = await _tests_script_and_cleanup( |
| 1333 | input_model, |
| 1334 | source_method, |
| 1335 | topmost, |
| 1336 | model_image_size, |
| 1337 | input_device, |
| 1338 | input_delay, |
| 1339 | resize_factor, |
| 1340 | ai_conf, |
| 1341 | video_file, |
| 1342 | ) |
| 1343 | raw_output = "".join(_stream_tests(script, cleanup_paths)) |
| 1344 | output, status = _split_stream_result(raw_output) |
| 1345 | if not status or status.get("ok") is False: |
| 1346 | raise HTTPException( |
| 1347 | status_code=500, |
| 1348 | detail={"message": (status or {}).get("message", "Detection test failed."), "output": output}, |
| 1349 | ) |
| 1350 | return {"ok": True, "message": status.get("message", "Detection test completed."), "output": output} |
| 1351 | |
| 1352 | |
| 1353 | @app.post("/api/tests/run/stream") |
nothing calls this directly
no test coverage detected