Skip to content

Commit

Permalink
refactor(focoos): get_model_by_name found logic
Browse files Browse the repository at this point in the history
  • Loading branch information
giuseppeambrosio97 committed Dec 9, 2024
1 parent 711c75c commit 1a97d02
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions focoos/focoos.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,10 @@ def get_dataset_by_name(self, name: str) -> Optional[DatasetMetadata]:
def get_model_by_name(
self, name: str, remote=True
) -> Optional[Union[RemoteModel, LocalModel]]:
found = False
models = self.list_models()
for model in models:
if name.lower() == model.name.lower():
found = True
break
if found:
if remote:
return self.get_remote_model(model.ref)
else:
return self.get_local_model(model.ref)
else:
return None
if remote:
return self.get_remote_model(model.ref)
else:
return self.get_local_model(model.ref)

0 comments on commit 1a97d02

Please sign in to comment.