Spaces:
Running
Running
Download utils.py from chuanenlin/pdf2preview: direct link, hf CLI and curl.
- Browser
- Download file 339 Bytes
-
https://huggingface.co/spaces/chuanenlin/pdf2preview/resolve/main/utils.py
- Command line
-
hf download hf://spaces/chuanenlin/pdf2preview/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/chuanenlin/pdf2preview/resolve/main/utils.py
339 Bytes
| import urllib.request | |
| import os | |
| from pathlib import Path | |
| def download_file(download_url): | |
| response = urllib.request.urlopen(download_url) | |
| filename = Path(download_url).name | |
| file = open(filename, 'wb') | |
| file.write(response.read()) | |
| file.close() | |
| return filename | |
| def remove_file(local_path): | |
| os.remove(local_path) | |