Skip to content

Commit

Permalink
Merge pull request #839 from landoskape/no-name-doubles
Browse files Browse the repository at this point in the history
Prevent list of trained model names from having repeats
  • Loading branch information
carsen-stringer authored Feb 13, 2024
2 parents c2821cd + ecad632 commit 3e8f27a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cellpose/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ def add_model(filename):
except shutil.SameFileError:
pass
print(f'{filename} copied to models folder {os.fspath(models.MODEL_DIR)}')
with open(models.MODEL_LIST_PATH, 'a') as textfile:
textfile.write(fname + '\n')
if fname not in models.get_user_models():
with open(models.MODEL_LIST_PATH, 'a') as textfile:
textfile.write(fname + '\n')

def imsave(filename, arr):
ext = os.path.splitext(filename)[-1].lower()
Expand Down

0 comments on commit 3e8f27a

Please sign in to comment.