stable-diffusion-webui-promptgen icon indicating copy to clipboard operation
stable-diffusion-webui-promptgen copied to clipboard

Added an API

Open MrLappes opened this issue 2 years ago • 2 comments

Added a new api_generate and a return_available_models function in promptgen.py and added api.py which uses these to get the same behaviour in api as in Webui

MrLappes avatar Jul 18 '23 10:07 MrLappes

Hi @MrLappes I installed your branch. I called the endpoints GET /promptgen/list_models and POST /promptgen/generate Unfortunatelly it just returns RuntimeError: (404, '{"detail":"Not Found"}')

http://localhost:7860/sdapi/v1/promptgen/list_models returns 404

I am running --api parameter when running webui. Is there any missing configuration?

Thanks!

davidmartinrius avatar Mar 11 '24 13:03 davidmartinrius

Ah I see what happens... The endpoints of that branch are not defined in

stable-diffusion-webui/modules/api/api.py

So it cannot be called such as http://localhost:7860/sdapi/v1/promptgen/list_models

but

http://localhost:7860/promptgen/list_models

Solved!

davidmartinrius avatar Mar 11 '24 13:03 davidmartinrius