feat: add -H --height and -W --width options #1248#1255
feat: add -H --height and -W --width options #1248#1255opsec-ai wants to merge 2 commits intoleejet:masterfrom
Conversation
wbruna
left a comment
There was a problem hiding this comment.
The parameters themselves are already supported by parse_options(). The real issue is simply that the parsed values are always overridden when decoding the API parameters.
|
That's because the vast majority of clients/UI's always send a default height and width in the query. In order to test this, you have to make, or find a special UI that does not send height and width (unless the user specifies). Example: # don't send height and width unless specified
if (width === "0" && height === "0"){
json_str = JSON.stringify({
prompt: prompt,
batch_size: parseInt(batch_size),
steps: parseInt(steps)
});
} else {
json_str = JSON.stringify({
prompt: prompt,
batch_size: parseInt(batch_size),
width: parseInt(width),
height: parseInt(height),
steps: parseInt(steps)
});
}
try {
const send_request = json_str;
const response = await fetch('http://localhost:1234/sdapi/v1/txt2img', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: send_request
});
const result = await response.json();
# do something with result |
#1166 behaves like that. But again, I'm not arguing about the issue, I'm arguing about the change: it doesn't make sense to 'add' those parameters to the server because it should already support them, since the command-line parsing code is shared with the You must be a dense model (sorry, couldn't resist). |
|
Right, but the server hard codes 512 as the default. Oh. I see what you mean. They're in |
After falling on my face with the first PR, it seemed necessary to get up and try again with a different issue.
Setting the default -H (--height) and -W (--width) options from the
sd-servercommand line.There is nothing special to this. Manually added
.default_widthand.default_heighttostruct SDSvrParamsand initialized both endpoints with that, instead512.