From 16e41b0c1a8b87ab4b06ec909bf1203f6d00739c Mon Sep 17 00:00:00 2001 From: michivonah Date: Sun, 31 Mar 2024 19:58:43 +0200 Subject: [PATCH] add dall e image creation script --- openai/create_image.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 openai/create_image.py diff --git a/openai/create_image.py b/openai/create_image.py new file mode 100644 index 0000000..2488460 --- /dev/null +++ b/openai/create_image.py @@ -0,0 +1,21 @@ +from openai import OpenAI +import os +from dotenv import load_dotenv + +load_dotenv() + +api_key = os.getenv('OPENAI_API_KEY') + +client = OpenAI() + +response = client.images.generate( + model="dall-e-2", + prompt="a picture with two mammoths, one with light fur and the other with brown fur, 3d art", + size="1024x1024", + quality="standard", + n=1, +) + +image_url = response.data[0].url + +print(image_url) \ No newline at end of file