From da6d273ccf1db578cad7763a00271e6accfb4a7d Mon Sep 17 00:00:00 2001 From: Konie Date: Wed, 25 Oct 2023 13:44:16 +0800 Subject: [PATCH] Add get fooocus styles api --- README.md | 5 ++++- docs/openapi.json | 23 +++++++++++++++++++++++ fooocus_api_version.py | 2 +- fooocusapi/api.py | 6 ++++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdfdd23..4236e2c 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,7 @@ Get all filenames of base model and lora. #### Refresh Models > POST /v1/engines/refresh-models -Refresh local files and get all filenames of base model and lora. \ No newline at end of file +#### Get All Fooocus Styles +> GET /v1/engines/styles + +Get all legal Fooocus styles. \ No newline at end of file diff --git a/docs/openapi.json b/docs/openapi.json index 321e03f..0c0d1b6 100644 --- a/docs/openapi.json +++ b/docs/openapi.json @@ -497,6 +497,29 @@ } } } + }, + "/v1/engines/styles": { + "get": { + "summary": "All Styles", + "description": "Get all legal Fooocus styles", + "operationId": "all_styles_v1_engines_styles_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Response All Styles V1 Engines Styles Get" + } + } + } + } + } + } } }, "components": { diff --git a/fooocus_api_version.py b/fooocus_api_version.py index c3e4772..cec771e 100644 --- a/fooocus_api_version.py +++ b/fooocus_api_version.py @@ -1 +1 @@ -version = '0.2.3' \ No newline at end of file +version = '0.2.4' \ No newline at end of file diff --git a/fooocusapi/api.py b/fooocusapi/api.py index 9b4f2ec..d5673d6 100644 --- a/fooocusapi/api.py +++ b/fooocusapi/api.py @@ -164,6 +164,12 @@ def refresh_models(): path.update_all_model_names() return AllModelNamesResponse(model_filenames=path.model_filenames, lora_filenames=path.lora_filenames) + +@app.get("/v1/engines/styles", response_model=List[str], description="Get all legal Fooocus styles") +def all_styles(): + from modules.sdxl_styles import legal_style_names + return legal_style_names + def start_app(args): uvicorn.run("fooocusapi.api:app", host=args.host, port=args.port, log_level=args.log_level)