Spaces:
Running
Running
Download src/services/task_contract.py from Leon4gr45/brain: direct link, hf CLI and curl.
- Browser
- Download file 416 Bytes
-
https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/services/task_contract.py
- Command line
-
hf download hf://spaces/Leon4gr45/brain/src/services/task_contract.py
-
curl -L -o task_contract.py https://huggingface.co/spaces/Leon4gr45/brain/resolve/main/src/services/task_contract.py
416 Bytes
| """A rejected or malformed ingestion response must never start task polling.""" | |
| def accepted_task_id(status, payload): | |
| task_id = payload.get('task_id') if isinstance(payload, dict) else None | |
| if status != 202 or not isinstance(task_id, str) or task_id.strip().lower() in {'', 'none', 'null'}: | |
| raise ValueError('INGESTION_CONTRACT_ERROR: expected HTTP 202 with a non-empty task_id') | |
| return task_id | |