Spaces:
Sleeping
Sleeping
| 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) | |