mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
make the docstring more readable and improve the list_models logic
Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com>
This commit is contained in:
parent
fdf41cc739
commit
248068fe5d
@ -125,15 +125,18 @@ class ModelCache(object):
|
|||||||
def list_models(self) -> dict:
|
def list_models(self) -> dict:
|
||||||
'''
|
'''
|
||||||
Return a dict of models in the format:
|
Return a dict of models in the format:
|
||||||
{ model_name1: {'status': ('active'|'cached'|'not loaded'),
|
{
|
||||||
|
model_name1: {
|
||||||
|
'status': ('active'|'cached'|'not loaded'),
|
||||||
'description': description,
|
'description': description,
|
||||||
},
|
},
|
||||||
model_name2: { etc }
|
model_name2: { etc },
|
||||||
|
}
|
||||||
'''
|
'''
|
||||||
result = dict()
|
models = {}
|
||||||
for name in self.config:
|
for name, config in self.config.items():
|
||||||
try:
|
try:
|
||||||
description = self.config[name].description
|
description = config.description
|
||||||
except ConfigAttributeError:
|
except ConfigAttributeError:
|
||||||
description = '<no description>'
|
description = '<no description>'
|
||||||
|
|
||||||
@ -144,11 +147,13 @@ class ModelCache(object):
|
|||||||
else:
|
else:
|
||||||
status = 'not loaded'
|
status = 'not loaded'
|
||||||
|
|
||||||
result[name]={
|
models = models.update(
|
||||||
|
name = {
|
||||||
'status': status,
|
'status': status,
|
||||||
'description' : description
|
'description': description,
|
||||||
}
|
})
|
||||||
return result
|
|
||||||
|
return models
|
||||||
|
|
||||||
def print_models(self) -> None:
|
def print_models(self) -> None:
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user