Spaces:
Sleeping
Sleeping
Download utils.py from robtacconelli/Nacrith-CPU: direct link, hf CLI and curl.
- Browser
- Download file 350 Bytes
-
https://huggingface.co/spaces/robtacconelli/Nacrith-CPU/resolve/main/utils.py
- Command line
-
hf download hf://spaces/robtacconelli/Nacrith-CPU/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/robtacconelli/Nacrith-CPU/resolve/main/utils.py
350 Bytes
| """Utility functions for the Nacrith CPU compressor.""" | |
| def format_size(num_bytes: int) -> str: | |
| """Format byte count as human-readable string.""" | |
| if num_bytes < 1024: | |
| return f"{num_bytes} B" | |
| elif num_bytes < 1024 * 1024: | |
| return f"{num_bytes / 1024:.1f} KB" | |
| else: | |
| return f"{num_bytes / (1024 * 1024):.2f} MB" | |