Spaces:
Sleeping
Sleeping
Download src/utils.py from kostasang/Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 519 Bytes
-
https://huggingface.co/spaces/kostasang/Final_Assignment_Template/resolve/main/src/utils.py
- Command line
-
hf download hf://spaces/kostasang/Final_Assignment_Template/src/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/kostasang/Final_Assignment_Template/resolve/main/src/utils.py
519 Bytes
| import requests | |
| def download_file(url: str, local_filepath: str) -> None: | |
| """ | |
| Download a file from a URL and save it locally. | |
| Args: | |
| url (str): The URL of the file to download. | |
| local_filename (str): The local path where the file will be saved. | |
| """ | |
| with requests.get(url, stream=True) as response: | |
| response.raise_for_status() | |
| with open(local_filepath, 'wb') as file: | |
| for chunk in response.iter_content(chunk_size=8192): | |
| file.write(chunk) | |