Skip to content

Commit

Permalink
update params
Browse files Browse the repository at this point in the history
  • Loading branch information
cxnt committed Dec 25, 2023
1 parent 5deddd7 commit 5e7257e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions serve/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,27 @@ def load_on_device(
dst_path=weights_dst_path,
)
else:
# ------------------------ #
model_source = deploy_params["model_source"] # Pretrained models or Custom models
# ------------------------ #
model_source = deploy_params["model_source"] # "pretrained" / "custom"
self.task_type = deploy_params["task_type"]
weights_file_name = deploy_params["weights_name"]
weights_dst_path = os.path.join(model_dir, weights_file_name)
if model_source == "Pretrained models":

if model_source == "pretrained":
weights_url = f"https://github.com/ultralytics/assets/releases/download/v0.0.0/{weights_file_name}"
if not sly.fs.file_exists(weights_dst_path):
self.download(
src_path=weights_url,
dst_path=weights_dst_path,
)

if not sly.fs.file_exists(weights_dst_path):
custom_weights_path = deploy_params["custom_weights_path"]
self.download(
src_path=custom_weights_path,
dst_path=weights_dst_path,
)

elif model_source == "custom":
if not sly.fs.file_exists(weights_dst_path):
custom_weights_path = deploy_params["custom_weights_path"]
self.download(
src_path=custom_weights_path,
dst_path=weights_dst_path,
)
# ------------------------ #

self.model = YOLO(weights_dst_path)
Expand Down

0 comments on commit 5e7257e

Please sign in to comment.