Spaces:
Paused
Paused
Download scripts/run_depth.py from nanii141149/Depth_wizard: direct link, hf CLI and curl.
- Browser
- Download file 764 Bytes
-
https://huggingface.co/spaces/nanii141149/Depth_wizard/resolve/main/scripts/run_depth.py
- Command line
-
hf download hf://spaces/nanii141149/Depth_wizard/scripts/run_depth.py
-
curl -L -o run_depth.py https://huggingface.co/spaces/nanii141149/Depth_wizard/resolve/main/scripts/run_depth.py
764 Bytes
| #!/usr/bin/env python3 | |
| """Run Depth Anything V2 and save lossless float32 depth plus a visual PNG.""" | |
| import argparse, sys | |
| from pathlib import Path | |
| ROOT=Path(__file__).resolve().parents[1]; sys.path.insert(0,str(ROOT)) | |
| from src.depth_inference import run_inference | |
| parser=argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("image",nargs="?",type=Path,default=ROOT/"gamus_rgb.png") | |
| parser.add_argument("--output-dir",type=Path,default=ROOT/"outputs") | |
| args=parser.parse_args() | |
| try: | |
| image=args.image if args.image.is_absolute() else (Path.cwd()/args.image).resolve() | |
| out=args.output_dir if args.output_dir.is_absolute() else (ROOT/args.output_dir).resolve() | |
| run_inference(image,out) | |
| except Exception as exc: parser.exit(1,f"Error: {exc}\n") | |