Spaces:
Sleeping
Sleeping
Download code/device_engine.py from acra-thesis/acra-backend: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/spaces/acra-thesis/acra-backend/resolve/main/code/device_engine.py
- Command line
-
hf download hf://spaces/acra-thesis/acra-backend/code/device_engine.py
-
curl -L -o device_engine.py https://huggingface.co/spaces/acra-thesis/acra-backend/resolve/main/code/device_engine.py
545 Bytes
| """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'}, | |
| ) | |