Download lam2/lib/python3.8/site-packages/identify/cli.py from anusfoil/LLaQo-ckpts: direct link, hf CLI and curl.
- Browser
- Download file 730 Bytes
-
https://huggingface.co/anusfoil/LLaQo-ckpts/resolve/main/lam2/lib/python3.8/site-packages/identify/cli.py
- Command line
-
hf download hf://anusfoil/LLaQo-ckpts/lam2/lib/python3.8/site-packages/identify/cli.py
-
curl -L -o cli.py https://huggingface.co/anusfoil/LLaQo-ckpts/resolve/main/lam2/lib/python3.8/site-packages/identify/cli.py
730 Bytes
| from __future__ import annotations | |
| import argparse | |
| import json | |
| from typing import Sequence | |
| from identify import identify | |
| def main(argv: Sequence[str] | None = None) -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--filename-only', action='store_true') | |
| parser.add_argument('path') | |
| args = parser.parse_args(argv) | |
| if args.filename_only: | |
| func = identify.tags_from_filename | |
| else: | |
| func = identify.tags_from_path | |
| try: | |
| tags = sorted(func(args.path)) | |
| except ValueError as e: | |
| print(e) | |
| return 1 | |
| if not tags: | |
| return 1 | |
| else: | |
| print(json.dumps(tags)) | |
| return 0 | |
| if __name__ == '__main__': | |
| raise SystemExit(main()) | |