Spaces:
Runtime error
Runtime error
Download modules/utils.py from Shanur/oculus-ui-detector: direct link, hf CLI and curl.
- Browser
- Download file 907 Bytes
-
https://huggingface.co/spaces/Shanur/oculus-ui-detector/resolve/main/modules/utils.py
- Command line
-
hf download hf://spaces/Shanur/oculus-ui-detector/modules/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Shanur/oculus-ui-detector/resolve/main/modules/utils.py
907 Bytes
| import time | |
| import logging | |
| from functools import wraps | |
| logger = logging.getLogger(__name__) | |
| def timing_decorator(func): | |
| """Decorator to log the execution time of a function.""" | |
| async def wrapper(*args, **kwargs): | |
| start_time = time.time() | |
| result = await func(*args, **kwargs) | |
| elapsed_time = time.time() - start_time | |
| logger.info(f"Function '{func.__name__}' completed in {elapsed_time:.2f} seconds") | |
| return result | |
| return wrapper | |
| def sync_timing_decorator(func): | |
| """Decorator to log the execution time of a synchronous function.""" | |
| def wrapper(*args, **kwargs): | |
| start_time = time.time() | |
| result = func(*args, **kwargs) | |
| elapsed_time = time.time() - start_time | |
| logger.info(f"Function '{func.__name__}' completed in {elapsed_time:.2f} seconds") | |
| return result | |
| return wrapper |