以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2023/12/13/203703より取得しました。


OpenAI APIで画像生成をしてみる

実際のところ

from openai import OpenAI
from dotenv import dotenv_values

def genImage(client):
  response = client.images.generate(
    model="dall-e-3",
    prompt="a black cat on an american classic car.",
    size="1024x1024",
    quality="standard",
    n=1
  )
  return response

config = dotenv_values(".env")

yourclient = OpenAI( api_key= config["OPENAI_API_KEY"] )

result = genImage(yourclient)
image_url = result.data[0].url
print(image_url)

試しにやってみるとURLが表示され…

$ python3 imagegenTest.py
https://oaidalleapiprodscus.blob.core.windows.net/private/org-n...

アクセスすると、こんなのが出てきます。




以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2023/12/13/203703より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14