Skip to content

Commit

Permalink
add a get models list api route (#4519)
Browse files Browse the repository at this point in the history
* get models list api route

* remove copypasta
  • Loading branch information
mcmonkey4eva committed Aug 21, 2024
1 parent f07e5bb commit 5e806f5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ def get_embeddings(self):
embeddings = folder_paths.get_filename_list("embeddings")
return web.json_response(list(map(lambda a: os.path.splitext(a)[0], embeddings)))

@routes.get("/models/{folder}")
async def get_models(request):
folder = request.match_info.get("folder", None)
if not folder in folder_paths.folder_names_and_paths:
return web.Response(status=404)
files = folder_paths.get_filename_list(folder)
return web.json_response(files)

@routes.get("/extensions")
async def get_extensions(request):
files = glob.glob(os.path.join(
Expand Down

0 comments on commit 5e806f5

Please sign in to comment.