mirror of
https://github.com/michivonah/python.git
synced 2025-12-22 12:46:27 +01:00
add dall e image creation script
This commit is contained in:
parent
6f7f14d9fe
commit
16e41b0c1a
1 changed files with 21 additions and 0 deletions
21
openai/create_image.py
Normal file
21
openai/create_image.py
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue