Spaces:
Sleeping
Sleeping
Download utils.py from habeebCycle/Retina_Training: direct link, hf CLI and curl.
- Browser
- Download file 523 Bytes
-
https://huggingface.co/spaces/habeebCycle/Retina_Training/resolve/main/utils.py
- Command line
-
hf download hf://spaces/habeebCycle/Retina_Training/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/habeebCycle/Retina_Training/resolve/main/utils.py
523 Bytes
| from __future__ import annotations | |
| from pathlib import Path | |
| import zipfile | |
| import shutil | |
| def unzip_dataset(zip_path: str | Path, extract_to: str | Path) -> str: | |
| zip_path = Path(zip_path) | |
| extract_to = Path(extract_to) | |
| extract_to.mkdir(parents=True, exist_ok=True) | |
| with zipfile.ZipFile(zip_path, 'r') as zf: | |
| zf.extractall(extract_to) | |
| return str(extract_to) | |
| def clean_dir(path: str | Path): | |
| p = Path(path) | |
| if p.exists(): | |
| shutil.rmtree(p) | |
| p.mkdir(parents=True, exist_ok=True) |