INNER CODE UNIT · Python
full_path
416rehman/DeepZero · src/deepzero/api/server.py:122
full_path = sample_dir / apath
if full_path.exists():
content = full_path.read_text(encoding="utf-8", errors="replace")
return JSONResponse({"artifact": artifact_name, "content": content})
return JSONResponse({"error": f"artifact '{artifact_name}' not found"}, status_code=404)
routes = [
Route("/api/health", health),
Route("/api/runs", get_runs),
Route("/api/run", get_run),
Route("/api/samples", get_samples),
Route("/api/samples/{sample_id}", get_sample),
Route("/api/samples/{sample_id}/artifacts/{name}", get_sample_artifact),
]
return Starlette(routes=routes)