Skip to content

Commit

Permalink
change wget to curl to make download work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
AgainstEntropy committed Aug 22, 2024
1 parent 05a8850 commit 0a49224
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

def download_model(url, output_dir):
"""
Download a file from a given URL using wget, if it doesn't already exist.
Download a file from a given URL using curl, if it doesn't already exist.
Args:
- url: str, the URL of the file to download.
- output_dir: str, the directory where the file should be saved.
Returns:
- str: The path to the downloaded file.
"""
file_name = url.split("/")[-1]
output_path = os.path.join(output_dir, file_name)

if os.path.exists(output_path):
print(f"File {file_name} already exists in {output_dir}. Skipping download.")
return output_path

try:
subprocess.run(["wget", url, "-O", output_path], check=True)
subprocess.run(["curl", url, "--output", output_path], check=True)
print(f"Downloaded {file_name} to {output_dir}")
except subprocess.CalledProcessError as e:
print(f"Failed to download {file_name}: {e}")
raise

return output_path

0 comments on commit 0a49224

Please sign in to comment.