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)
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)

'python' 카테고리의 다른 글
사자와 코끼리가 휴대폰 대리점에 나누는 대화 (2) | 2023.11.22 |
---|---|
챗gpt 전체소스 (1) | 2023.11.22 |
dall-e-3를 활용한 이미지 생성 (0) | 2023.11.22 |
Python 챗GPT 개발환경(4세대 12기가 윈10) (0) | 2023.11.20 |
ChatGPT 연결코드 수정 (0) | 2023.11.20 |