Download import.py from PDAP/inference_prototype_test: direct link, hf CLI and curl.
- Browser
- Download file 821 Bytes
-
https://huggingface.co/PDAP/inference_prototype_test/resolve/267dcd2f3408dc367d2ed860ed80193cc010b44c/import.py
- Command line
-
hf download hf://PDAP/inference_prototype_test@267dcd2f3408dc367d2ed860ed80193cc010b44c/import.py
-
curl -L -o import.py https://huggingface.co/PDAP/inference_prototype_test/resolve/267dcd2f3408dc367d2ed860ed80193cc010b44c/import.py
821 Bytes
| from pathlib import Path | |
| from types import FitPredictor | |
| def find_repo_root(start_path: Path = Path.cwd()) -> Path: | |
| """Finds the root of the repo by locating the nearest pyproject.toml.""" | |
| current = start_path.resolve() | |
| for parent in [current] + list(current.parents): | |
| if (parent / "pyproject.toml").is_file(): | |
| return parent | |
| raise FileNotFoundError("No pyproject.toml found in any parent directories.") | |
| def get_single_file(path: Path) -> Path: | |
| files = [f for f in path.iterdir() if f.is_file()] | |
| if len(files) != 1: | |
| raise ValueError(f"Expected exactly one file in {path}, found {len(files)}") | |
| return files[0] | |
| def load_model() -> FitPredictor: | |
| repo_root = find_repo_root() | |
| model_path = get_single_file(repo_root / "model") | |
| raise NotImplementedError | |