2023. 11. 22. 13:23
import openai
import os

API_KEY = os.environ.get('OPENAI_API_KEY')
openai.api_key = API_KEY
model_engine = "dall-e-3"




def generateImage(animal1, animal2, scenario):
response = openai.Image.create(
model=model_engine,
#prompt=f"cartoon image of a {animal1} and a {animal2} discussing {scenario}",
prompt=f"{animal1}() {animal2}() {scenario}에서 이야기하고 있는 카툰 이미지",
n=1,
size="1024x1024",
response_format="url"
)

image_url = response.data[0]["url"]
return image_url


url = generateImage('호랑이', '러시안 블루 고양이', '스타벅스')
print(url)
 
Posted by 다만사