MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / get_path

Function get_path

draggan/utils.py:36–45  ·  view source on GitHub ↗
(base_path)

Source from the content-addressed store, hash-verified

34
35
36def get_path(base_path):
37 save_path = os.path.join(BASE_DIR, base_path)
38 if not os.path.exists(save_path):
39 url = f"https://huggingface.co/aaronb/StyleGAN2-pkl/resolve/main/{base_path}"
40 print(f'{base_path} not found')
41 print('Try to download from huggingface: ', url)
42 os.makedirs(os.path.dirname(save_path), exist_ok=True)
43 download_url(url, save_path)
44 print('Downloaded to ', save_path)
45 return save_path
46
47
48def tensor_to_PIL(img: torch.Tensor) -> PIL.Image.Image:

Callers

nothing calls this directly

Calls 1

download_urlFunction · 0.70

Tested by

no test coverage detected