HanaokaYuzu/NovelAI-API

Image Vibe Transfer not working

a-pretty-parrot opened this issue · 2 comments

I am trying to do vibe transfer as per the README, but it doesnt seem to be using the image i send to it at all.

i am running the code:

async def gen_image(client, start_img):
    logger.info('start image: %s' % start_img)
    with open(start_img, "rb") as f:
        base_image = base64.b64encode(f.read()).decode("utf-8")

    # generate the ''pos_prompt''
    pos_prompt = 'wearing a pink hat'
    metadata = Metadata(
        prompt=pos_prompt,
        reference_image=base_image,
        reference_strength=0.30,
        reference_information_extracted=1,
        add_original_image=True,  # This Not affect the vibe generation
        qualityToggle=True,
    )

    output = await client.generate_image(metadata, verbose=True)

    images = []
    for image in output:
        print('image: %s' % image)
        print('type: %s' % type(image.data))
        new_image = await save_image(image.data, './results')
        return new_image
        
        
client = NAIClient(username, password, proxy=None)
client.init(timeout=60)
gen_image(client, './baby_platypus.webp')

everything seems to work - but the image is definitely not using the 'baby_platypus' image :) but i do get an image back.

@a-pretty-parrot
The reference_image field of the image generation API requires a 448*448 black background, which is subject to bicubic interpolation to achieve maximum scaling. Here is how you should handle your input: L160

ah ok, ty.

i have it working now :> I downloaded and installed locally to add debug and went through things.
Found one thing I assume is a bug, will make PR for it.

Im still not sure why I could do the from novelai import Resolution, Sampler fine when it was local, but doesnt work with the pip one.

not that big of a deal though, I will make separate issue for tracking there and close this one.

thank you again :>