Aedial / novelai-api

Python API for the NovelAI REST API
https://aedial.github.io/novelai-api/
MIT License
129 stars 17 forks source link

Undesired content no longer set properly on image generation #14

Closed llamabeast1 closed 1 year ago

llamabeast1 commented 1 year ago

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?

llamabeast1 commented 1 year ago

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,
        }
clharper42 commented 1 year ago

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 1 year ago

Fixed in 915e83a Change was unexpected.