w-e-w/sd-webui-nudenet-nsfw-censor

Read settings from api payload during txt2img

Closed this issue · 3 comments

Hi,

Do you know how I can pass the settings for the script inside the /sdapi/v1/txt2img payload?

I'd like to set params programmatically instead of reading them from the web ui settings (and also without calling the /nudenet/censor cause it will take double of the time). Like writing them inside alwayson_scripts

{
    "prompt": "photo of woman",
    "alwayson_scripts": ...
}

And moreover if it's possible to receive as output both censored and not images.
Like:

{
    "image": "",
    "censored": ""
}

Thank you!

sorry I haven't got time to respond to this yet
can you elaborate what exactly by "read" settings "during" txt2img

if what you're asking is to be able change what the extension does on different txt2img (job) reques base on api payload

or are you asking how to some extract some info about the image during or after the job has finished?

hi! no problem, thank you for the reply.

basically I wanted to pass the thresholds parameters dynamically when using the /sdapi/v1/txt2img endpoint, instead of using the fixed one inside settings.

but no problem, thank you so much for the code, it's really helpful, I will try to handle it by myself inside a separated endpoint since I need to add more information inside the output :)

I wanted to pass the thresholds parameters dynamically when using the /sdapi/v1/txt2img endpoint

don't I allow that already or am I missing something?
https://github.com/w-e-w/sd-webui-nudenet-nsfw-censor?tab=readme-ov-file#api-example

    "thresholds":  [1, 1, 1, 0.25, 0.25, 1, 0.25, 1.0, 1.0, 1, 1, 1, 1, 1, 0.25, 1.0, 1.0, 1],