Download scripts/fetch-template.py from suvadityamuk/3d-representations-guide: direct link, hf CLI and curl.
- Browser
- Download file 885 Bytes
-
https://huggingface.co/spaces/suvadityamuk/3d-representations-guide/resolve/main/scripts/fetch-template.py
- Command line
-
hf download hf://spaces/suvadityamuk/3d-representations-guide/scripts/fetch-template.py
-
curl -L -o fetch-template.py https://huggingface.co/spaces/suvadityamuk/3d-representations-guide/resolve/main/scripts/fetch-template.py
885 Bytes
| import urllib.request, pathlib, json | |
| root=pathlib.Path(__file__).resolve().parents[1] | |
| repo='tfrere/research-article-template' | |
| rev='c75fc29c361755f66c46ae6e83d958b10c4d5feb' | |
| base=f'https://huggingface.co/spaces/{repo}/raw/{rev}/' | |
| paths=['LICENSE','app/src/components/TableOfContents.astro','app/src/components/ThemeToggle.astro','app/src/components/Wide.astro','app/src/components/Reference.astro','app/src/components/Note.astro','app/src/components/Accordion.astro','app/src/components/HtmlEmbed.astro'] | |
| for p in paths: | |
| data=urllib.request.urlopen(base+p).read() | |
| dest=root/('LICENSE.template' if p=='LICENSE' else p.removeprefix('app/')) | |
| dest.parent.mkdir(parents=True,exist_ok=True);dest.write_bytes(data) | |
| print('Downloaded',len(paths),'template files at',rev) | |
| (root/'docs/template-provenance.json').write_text(json.dumps({'repo':repo,'revision':rev,'files':paths},indent=2)+'\n') | |