Search code examples
pythonopenai-api

Attribute Error: openai has no attribute Image


So I was getting my hands-on on the new DALL.E api for Python which has been made public. I was getting the Attribution Error as it was not detecting the Image model in Open ai after running the following code:

response = openai.Image.create(
  prompt="a white siamese cat",
  n=1,
  size="1024x1024"
)
image_url = response['data'][0]['url']

Why am I getting this error?


Solution

  • I just found the solution. You have to upgrade your openai library with code:

    pip install --upgrade openai
    

    Restart the kernel, and enjoy :)