Download testing/log_time.py from OpkaGames/NeuroGPT: direct link, hf CLI and curl.
- Browser
- Download file 616 Bytes
-
https://huggingface.co/spaces/OpkaGames/NeuroGPT/resolve/main/testing/log_time.py
- Command line
-
hf download hf://spaces/OpkaGames/NeuroGPT/testing/log_time.py
-
curl -L -o log_time.py https://huggingface.co/spaces/OpkaGames/NeuroGPT/resolve/main/testing/log_time.py
616 Bytes
| from time import time | |
| async def log_time_async(method: callable, **kwargs): | |
| start = time() | |
| result = await method(**kwargs) | |
| secs = f"{round(time() - start, 2)} secs" | |
| if result: | |
| return " ".join([result, secs]) | |
| return secs | |
| def log_time_yield(method: callable, **kwargs): | |
| start = time() | |
| result = yield from method(**kwargs) | |
| yield f" {round(time() - start, 2)} secs" | |
| def log_time(method: callable, **kwargs): | |
| start = time() | |
| result = method(**kwargs) | |
| secs = f"{round(time() - start, 2)} secs" | |
| if result: | |
| return " ".join([result, secs]) | |
| return secs | |