Aedial/novelai-api

Undesired content no longer set properly on image generation

llamabeast1 opened this issue · 3 comments

Since the apparent changes to the NovelAI API a couple of days ago, undesired content no longer seems to be set properly.

All the images I've been able to generate since come back with uc="" (and are notably low quality as a result!). I've confirmed that parameters['uc'] is properly set in _low_level.py when the API call is made. I guess perhaps the naming of the parameters at the NovelAI end has changed?

Okay, I've identified the issue. The required entry in parameters has changed from 'uc' to 'negative_prompt'.

As a temporary fix, we can simply add this line:

parameters["negative_prompt"] = parameters["uc"]

around line 647 of _low_level.py, just before

        args = {
            "input": prompt,
            "model": model.value,
            "parameters": parameters,
        }

On the topic of the parameter names here is a trick I learned. Since updates to the api can cause name changes you can check the names of the different parameters by generating a image on the novelai website while you have the network tab opened. This is also helpful if they add new parameters so you can see what they are and you can manually add them to ImagePreset and it should work automatically. I was able to manually add 'sm' and 'sm_dyn' and do image generations this way before this project got updated

image

Aedial commented

Fixed in 915e83a
Change was unexpected.