Skip to content

Commit

Permalink
Corrected method with intended function
Browse files Browse the repository at this point in the history
  • Loading branch information
landoskape committed Dec 8, 2023
1 parent 0aaf7f6 commit ecad632
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cellpose/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ def add_model(filename):
""" add model to .cellpose models folder to use with GUI or CLI """
from . import models
fname = os.path.split(filename)[-1]
overwrite = False
try:
shutil.copyfile(filename, os.fspath(models.MODEL_DIR.joinpath(fname)))
except shutil.SameFileError:
overwrite = True
pass
print(f'{filename} copied to models folder {os.fspath(models.MODEL_DIR)}')
if not overwrite:
if fname not in models.get_user_models():
with open(models.MODEL_LIST_PATH, 'a') as textfile:
textfile.write(fname + '\n')

Expand Down

0 comments on commit ecad632

Please sign in to comment.