Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shijianjian committed Sep 7, 2024
1 parent e3006bf commit 413006e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kornia/onnx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def download(

os.makedirs(os.path.dirname(file_path), exist_ok=True) # Create the cache directory if it doesn't exist

if not url.startswith(("http:", "https:")):
raise ValueError("URL must start with 'http:' or 'https:'")

# Download the file and save it
try:
urllib.request.urlretrieve(url, file_path)
Expand All @@ -109,8 +112,6 @@ def _fetch_repo_contents(folder: str) -> list[dict[str, Any]]:
"""
url = f"https://huggingface.co/api/models/kornia/ONNX_models/tree/main/{folder}"

if not url.startswith(("http:", "https:")):
raise ValueError("URL must start with 'http:' or 'https:'")
response = requests.get(url, timeout=10)

if response.status_code == 200:
Expand Down

0 comments on commit 413006e

Please sign in to comment.