"""Authenticated transfer of the installed inference artifact.""" from pathlib import Path from fastapi import HTTPException from fastapi.responses import FileResponse def engine_response(model_path): if not model_path or not Path(model_path).is_file(): raise HTTPException(503, detail='The device engine is unavailable. Try again later.') return FileResponse( model_path, media_type='application/octet-stream', headers={'Cache-Control': 'private, no-store', 'X-Content-Type-Options': 'nosniff'}, )