-
We need some examples or some tutorial for the built-in api. Could someone here write some knowledge or some things they learned when using it? We could add it as a wiki page. |
Beta Was this translation helpful? Give feedback.
Replies: 54 comments 97 replies
-
I am not a programmer so my knowledge is very limited, but nonetheless after a lot of banging sticks together I was able to figure out how to use the API (small tangential gripe, highly technical and experienced people are not very good at helping beginners how to code). I'll go through everything I learned about how to interface with the API. Apologies if I get a lot of terms and such wrong:
I can put in as few or as many parameters as I want in the payload. The API will use the defaults for anything I don't set.
Again, this URL needs to match the web ui's URL.
After that, I can get the information with A sample code that should work can look like this:
A note on
So in this case, when I send the payload, I should get a "cirno" at 20 steps, with the CLIP skip at 2, as well as the NSFW filter on. For certain settings or situations, you may want your changes to stay. For that you can post to the
After sending this payload to the API, the model should swap to the one I set and set the CLIP skip to 2. Reiterating, this is different from "override_settings", because this change will persist, while "override_settings" is for a single request. This is as of commit 47a44c7 For a more complete implementation of a frontend, my Discord bot is here if anyone wants to look at it as an example. Most of the action happens in stablecog.py. There are many comments explaining what each code does. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
The sample code is super helpful. When I used it with commit e725474 I ended up with binascii.Error: Incorrect padding from base64.b64decode(). Only after I cut off the leading 'data:image/png;base64,' from the returned image data things worked as expected. Python 3.10.6, ubuntu 22.04 FWIW |
Beta Was this translation helpful? Give feedback.
-
thank you for the code sample and information |
Beta Was this translation helpful? Give feedback.
-
I don't know why the API response was changed in this regard, but does anyone know how to pull the metadata string now in a simple way? What used to be this in the response I can see what I want at |
Beta Was this translation helpful? Give feedback.
-
can i override the settings with the "override_settings" value? if so what should i put in the json object? |
Beta Was this translation helpful? Give feedback.
-
infotexts only returns data for the first image. All data should be the same, except the seed, right? If the batch_size is greater than 1, then the seed from the first image is written in the png info. Maybe I'm missing something. I can see the "all_seeds" in the info, but in the infotexts, there is only the first image seed. |
Beta Was this translation helpful? Give feedback.
-
Is it posible to use on a network with CORS? Or on https with selfsigned certificate? |
Beta Was this translation helpful? Give feedback.
-
Somewhat silly question, but, hopefully, on topic, since we are talking about foggy documentation. How do I exit the function completely, without going through any loops that may remain? Like, there is a loop where every line with variables is presented in the cmd window. When a process is cancelled, generation stops, but the prompt texts fly through the cmd window till the end. Also, the description text below images (under preview window) is not shown at the end of a generation. My attempts to find the variable and assign it whatever is necessary have failed... Basic code in use can be seen here: https://github.com/some9000/StylePile |
Beta Was this translation helpful? Give feedback.
-
Hello, after I added the --api parameter, I did not see the interface of /sdapi/v1/txt2img What do I need to do to be able to see this interface |
Beta Was this translation helpful? Give feedback.
-
I'm seeing the same thing as sheququan, wonder whats going on? |
Beta Was this translation helpful? Give feedback.
-
there is a bat file and a shell script. All the tutorials say to modify the
bat, but because I deploy on Linux, I had to modify the shell script.
That didn’t work though, so I just went into the python file and removed
the config line that checks if the api is enabled, so it always runs
…On Thu, Nov 10, 2022 at 4:41 PM Kilvoctu ***@***.***> wrote:
@adenta <https://github.com/adenta> @sheququan
<https://github.com/sheququan> Try restarting after you set the --api
commandline argument, including closing out the Web UI tab too.
—
Reply to this email directly, view it on GitHub
<#3734 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGUU5UV6PO5I4CGPKAUOUTWHVTZ3ANCNFSM6AAAAAARPHJBIU>
.
You are receiving this because you were mentioned.Message ID:
<AUTOMATIC1111/stable-diffusion-webui/repo-discussions/3734/comments/4111705
@github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hey everyone, great to have an API! For me it seems to be working ok. |
Beta Was this translation helpful? Give feedback.
-
@Kilvoctu is there an override setting for custom models? |
Beta Was this translation helpful? Give feedback.
-
I've released a python API client library. |
Beta Was this translation helpful? Give feedback.
-
hi guys, I'm using python: 3.10.6 • torch: 1.13.1+cu117 • xformers: N/A • gradio: 3.16.2 • commit: 0cc0ee1b • checkpoint: b09ec8580e.
|
Beta Was this translation helpful? Give feedback.
-
Hi. I am trying to build an python 3.10 script to use the API. txt2img and simple img2img work fine but I can't make the inpainting mask work. I made an RGB png image and am trying to send it as mask but I get the error |
Beta Was this translation helpful? Give feedback.
-
is there any extension that can help us to generate API Request from web ui ? I think that would be great. |
Beta Was this translation helpful? Give feedback.
-
Any ideas why I'm getting blur image as an API response? but it doesn't happen on UI side Request body: API response: |
Beta Was this translation helpful? Give feedback.
-
bonjour les gars. J'aimerai savoir comment faire si je veux faire une requête img2img sur postman????? merci |
Beta Was this translation helpful? Give feedback.
-
Et aussi toujours dans cette lancé, j'aimerai savoir comment je peux m'y prendre si je veux générer plusieurs images (entrain de faire différentes actions) d'un même personnage |
Beta Was this translation helpful? Give feedback.
-
how to use the txt2img API? give a demo ?tks |
Beta Was this translation helpful? Give feedback.
-
Does the API support everything the UI does? |
Beta Was this translation helpful? Give feedback.
-
only one simple demo is ok,but where? |
Beta Was this translation helpful? Give feedback.
-
anyone experience timeout issue for txt2img API? it happens when the request takes more than 60 seconds, I use it on colab. |
Beta Was this translation helpful? Give feedback.
-
On Ubuntu 22.04, I've been having the issue that the doc doesn't show correctly (as reported by [philpax](#3734 (comment))). Restarting webui (with "--api") doesn't solve the issue. Using "--nowebui" does, but the port changes to 7861 and (of course) the webui cannot be used. Is there a solution to make the doc appear correctly with "--api"? |
Beta Was this translation helpful? Give feedback.
-
Brother just tell me how can i change the 'sampler_index': 'Euler', to 'DPM++2M Karras' |
Beta Was this translation helpful? Give feedback.
-
Is there a way I can use this API to control the UI? e.g. send API request for generate and as soon as it's done, image will be shown in the UI |
Beta Was this translation helpful? Give feedback.
-
When I make request at http://127.0.0.1:7860/sdapi/v1/txt2img directly using postman I am getting 404 error. Anyone knows how to fix this? |
Beta Was this translation helpful? Give feedback.
-
I wrote extension for asprite. Program for drawing. When i hit senddd nothing happens. I even did 0.0.0.0 or 127.0.0.1. |
Beta Was this translation helpful? Give feedback.
I am not a programmer so my knowledge is very limited, but nonetheless after a lot of banging sticks together I was able to figure out how to use the API (small tangential gripe, highly technical and experienced people are not very good at helping beginners how to code).
I'll go through everything I learned about how to interface with the API. Apologies if I get a lot of terms and such wrong:
First, of course, is to run web ui with
--api
commandline argumentset COMMANDLINE_ARGS=--api
This enables the api which can be reviewed at http://127.0.0.1:7860/docs (or whever the URL is + /docs)
The basic ones I'm interested in are these two. Let's just focu…