Stability-AI / stability-sdk

SDK for interacting with stability.ai APIs (e.g. stable diffusion inference)
https://platform.stability.ai/
MIT License
2.41k stars 339 forks source link

No Prompt with input image allowed? #269

Open andstu opened 7 months ago

andstu commented 7 months ago

Are you intended to be able to pass an input image without a prompt for the generate api?

        if (prompt is None) and (init_image is None):
            raise ValueError("prompt and/or init_image must be provided")

This error message implies that you should be able to. But later, it tries to iterate over the prompt object.

for p in prompt:
            if isinstance(p, str):
                p = generation.Prompt(text=p)
            elif not isinstance(p, generation.Prompt):
                raise TypeError("prompt must be a string or generation.Prompt object")
            prompts.append(p)

So when I don't pass a prompt in I get an error.

  File "/opt/homebrew/Caskroom/miniconda/base/envs/tile-texture/lib/python3.11/site-packages/stability_sdk/client.py", line 226, in generate
    for p in prompt:
TypeError: 'NoneType' object is not iterable