Skip to content

Commit

Permalink
Add route to list model types (comfyanonymous#4846)
Browse files Browse the repository at this point in the history
* Add list models route

* Better readable model types list
  • Loading branch information
ImDarkTom authored Sep 17, 2024
1 parent 254838f commit 7183fd1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ async def get_root(request):
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")
def list_model_types(request):
model_types = list(folder_paths.folder_names_and_paths.keys())

return web.json_response(model_types)

@routes.get("/models/{folder}")
async def get_models(request):
Expand Down

0 comments on commit 7183fd1

Please sign in to comment.