Commit bcc54ea9
Changed files (1)
examples
examples/picture.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+from openai import OpenAI
+
+# gets OPENAI_API_KEY from your environment variables
+openai = OpenAI()
+
+prompt = "An astronaut lounging in a tropical resort in space, pixel art"
+model = "dall-e-3"
+
+def main() -> None:
+ # Generate an image based on the prompt
+ response = openai.images.generate(prompt=prompt, model=model)
+
+ # Prints response containing a URL link to image
+ print(response)
+
+if __name__ == "__main__":
+ main()