Refactor the /v1/models endpoint
This commit is contained in:
parent
1b69694fe9
commit
43c53a7820
3 changed files with 28 additions and 80 deletions
|
@ -71,12 +71,12 @@ def natural_keys(text):
|
|||
|
||||
|
||||
def get_available_models():
|
||||
model_list = ['None']
|
||||
model_list = []
|
||||
for item in list(Path(f'{shared.args.model_dir}/').glob('*')):
|
||||
if not item.name.endswith(('.txt', '-np', '.pt', '.json', '.yaml', '.py')) and 'llama-tokenizer' not in item.name:
|
||||
model_list.append(re.sub('.pth$', '', item.name))
|
||||
|
||||
return sorted(model_list, key=natural_keys)
|
||||
return ['None'] + sorted(model_list, key=natural_keys)
|
||||
|
||||
|
||||
def get_available_presets():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue