Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an API #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

MrLappes
Copy link

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 added 4 commits July 18, 2023 12:17
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
changed api enpoint from generate_batch to generate
Fixed bug where not setting promptgen_device in on_ui_settings breaks when webui is started with flag --nowebui . It now just uses cpu if promptgen_device doesn't exist
The api that imported the promptgen script made the tab of promptgen in the webui appear twice, this has been fixed by extracting the script callbacks into another script. Maybe there was a more efficient way but i found this to be the easiest
@davidmartinrius
Copy link

davidmartinrius commented Mar 11, 2024

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
Copy link

davidmartinrius commented Mar 11, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants