Spaces:
Build error
Build error
Download src/utils/timer.py from mlmPenguin/LivePortrait: direct link, hf CLI and curl.
- Browser
- Download file 606 Bytes
-
https://huggingface.co/spaces/mlmPenguin/LivePortrait/resolve/main/src/utils/timer.py
- Command line
-
hf download hf://spaces/mlmPenguin/LivePortrait/src/utils/timer.py
-
curl -L -o timer.py https://huggingface.co/spaces/mlmPenguin/LivePortrait/resolve/main/src/utils/timer.py
606 Bytes
| # coding: utf-8 | |
| """ | |
| tools to measure elapsed time | |
| """ | |
| import time | |
| class Timer(object): | |
| """A simple timer.""" | |
| def __init__(self): | |
| self.total_time = 0. | |
| self.calls = 0 | |
| self.start_time = 0. | |
| self.diff = 0. | |
| def tic(self): | |
| # using time.time instead of time.clock because time time.clock | |
| # does not normalize for multithreading | |
| self.start_time = time.time() | |
| def toc(self, average=True): | |
| self.diff = time.time() - self.start_time | |
| return self.diff | |
| def clear(self): | |
| self.start_time = 0. | |
| self.diff = 0. | |