Bit early for it, but it’s supposed to drop well below freezing tonight, and then snow for a while on Monday.
(Update: I thought they'd make a nice Christmas card...)
I guess it’ll be a few more days before I find out how well Amazon packaged the squishably-soft silicone item compared to the robust boxing of the two glass items. Because it went back to the local depot Friday afternoon, hasn’t been updated since, and Amazon added their automatic five-day extension before I can even try to get my money back and order another one.
(if it does show up, there’s no guarantee it’s the same one that went out the first time; they’ve reused tracking numbers before)
I wanted to refine and upscale the 162 retro-sf waifu wallpapers I made a while back, but I definitely did not want to drag each image into the SwarmUI window, click “reuse parameters”, click “direct apply” on the preset containing the new settings, and then click “Generate”. That’s how I’ve been doing it for small sets, but it’s tedious and annoying, so I wanted to script it: extract the original parameters from the PNG as JSON, add a few new fields, then send a REST call to the SwarmUI server and download the results.
I knocked it together in Bash using exiftool, jq, and curl, and
it worked great… unless the image was made with a LoRA. Which almost
all of my wall-waifus are. I banged my head against the keyboard for a
while before giving up and posting a stripped-down repeat-by to the
Discord. Within half an hour, the developer had responded: the JSON
the app stores in an image’s metadata is not the format used by the
REST API; you can’t just round-trip it. (he acknowledges this is a
should-really-fix-sometime issue)
Specifically, fields that are returned as arrays must be sent as comma-separated strings:
# extracted metadata
...
"loras": [
"Qwen/Pin-up_Girl_-_CE_-_V01e_-_Qwen",
"Qwen/Qwen_Sex-_Nudes-_Other_Fun_Stuff_-SNOFS-_-_v1-1"
],
"loraweights": [
"1",
"0.5"
],
# /API/GenerateText2Image
...
"loras": "Qwen/Pin-up_Girl_-_CE_-_V01e_-_Qwen,Qwen/Qwen_Sex-_Nudes-_Other_Fun_Stuff_-SNOFS-_-_v1-1",
"loraweights": "1,0.5",
Fortunately, jq can do this for you as a one-liner:
JSON=$(jq -c '.loras |= join(",")' <<<"$JSON")
JSON=$(jq -c '.loraweights |= join(",")' <<<"$JSON")
This is not the only underdocumented aspect of the REST API; there are very few examples, none of which give comprehensive lists of valid parameters or complete output. If the anime drought continues, I may pull down a copy of the SwarmUI repo and send patches for the API docs.
I’ll add the script to my Github repo once I finish tinkering with options. I’ve already added an option for the variation-related params, since I’ve had to use that feature a lot when an almost perfect pic is ruined by bizarre anatomical malfunctions. I think I also want to try re-rendering at a larger size instead of scaling as much (1080x1920 render + 2x upscale instead of 576x1024 + 3.75x), in the hopes of reducing finger and toe damage. Newer models can cope with the higher initial resolution. (additional options will wait until I’ve converted it to Python; for a quick hack, Bash is fine, but it’s clunky at handling JSON and REST calls)
Markdown formatting and simple HTML accepted.
Sometimes you have to double-click to enter text in the form (interaction between Isso and Bootstrap?). Tab is more reliable.