Spaces:
Paused
Paused
Download task_interceptor.py from osamabyc/nouraoffload: direct link, hf CLI and curl.
- Browser
- Download file 327 Bytes
-
https://huggingface.co/spaces/osamabyc/nouraoffload/resolve/main/task_interceptor.py
- Command line
-
hf download hf://spaces/osamabyc/nouraoffload/task_interceptor.py
-
curl -L -o task_interceptor.py https://huggingface.co/spaces/osamabyc/nouraoffload/resolve/main/task_interceptor.py
327 Bytes
| # task_interceptor.py | |
| from processor_manager import should_offload | |
| from remote_executor import execute_remotely | |
| def offload_if_needed(func): | |
| def wrapper(*args, **kwargs): | |
| if should_offload(): | |
| return execute_remotely(func.__name__, args, kwargs) | |
| return func(*args, **kwargs) | |
| return wrapper | |