Skip to content

Commit

Permalink
format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
muzammil360 committed Nov 9, 2023
1 parent 7ab93bc commit eccf94b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions api/download_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from utils.download_file import download_if_file_not_exists

if __name__=='__main__':
if __name__ == "__main__":
filepath = os.path.join("..", "yolov6m.onnx")
download_if_file_not_exists(filepath, 'https://github.com/meituan/YOLOv6/releases/download/0.2.0/yolov6m.onnx')
download_if_file_not_exists(
filepath,
"https://github.com/meituan/YOLOv6/releases/download/0.2.0/yolov6m.onnx",
)
4 changes: 2 additions & 2 deletions api/utils/download_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import requests


def download_if_file_not_exists(filepath, url):
# Check if the file already exists at the specified filepath
if os.path.exists(filepath):
Expand All @@ -14,10 +15,9 @@ def download_if_file_not_exists(filepath, url):
response = requests.get(url)
response.raise_for_status() # Check for any request errors

with open(filepath, 'wb') as file:
with open(filepath, "wb") as file:
file.write(response.content)

print(f"File downloaded and saved to {filepath}.")
except Exception as e:
print(f"An error occurred while downloading the file: {e}")

0 comments on commit eccf94b

Please sign in to comment.