Microsoft Designer

DALL・E APIで文章から画像を作成してみました。

画像生成AI「DALL・E」のAPIがパブリックベータ版として一般公開されたので早速試してみました。

APIキーの取得

APIを実行するのにまずはアカウントを作成し、APIキーを取得する必要があります。

OpenAI APIのアカウント作成
  1. OpenAI APIのページから「Get started」ボタン( https://beta.openai.com/signup )をクリックします。
  2. 「Create your account」画面が表示されたらメールアドレスとパスワードを入力し「Continue」ボタンをクリックします。
  3. 入力したメールアドレス宛に通知メールが送信されるので、届いたメールを確認し、「Verify email address」ボタンをクリックします。
  4. 「Email verified」画面が表示されたら確認完了です。
APIキーの取得
  1. ログイン画面から作成したアカウント情報でログインします。
  2. 氏名と所属(任意)を入力し、「Continue」ボタンをクリックします(初回ログイン時のみ)。
  3. 初回ログイン時のみ携帯番号を入力し、SMS認証を行います。
  4. 利用目的を聞かれるので回答を選択します。
  5. 問題がなければ「Welcome to OpenAI」画面が表示されます。
  6. 画面右上のユーザーボタンをクリックし、表示されるメニューから「View API keys」を選択します。
  7. 「API keys」画面が表示されたら「Create new secret key」ボタンをクリックします。
  8. APIキーが作成されるので、忘れずにコピーしておきます。

以上でアカウントの作成とAPIキーの取得作業は完了です。

Images APIで文章から画像作成

APIキーの準備ができたので、さっそくImages APIで画像を作成してみます。

curl https://api.openai.com/v1/images/generations -H "Content-Type: application/json" -H "Authorization: Bearer (APIキー)" -d "{""prompt"": ""two dancing real ninja"", ""n"": 1, ""size"": ""512x512""}"

上記の通りcurlコマンドで「two dancing real ninja」をキーワードに画像を生成した結果が下図になります。

たしかに、“二人の踊るリアルなニンジャ”に見えます。

実際に使ってみるとAPIの実行は非常に簡単で、すぐに画像を作ることができました。
ただし、2022年11月時点でImages APIはまだベータ版であるため、下記制限事項があります。

The Images API is in beta. During this time the API and models will evolve based on your feedback. To ensure all users can prototype comfortably, the default rate limit is 10 images per minute, 25 per 5 minutes. If you would like to increase your rate limit, please review this help center article. We will increase the default rate limit as we learn more about usage and capacity requirements.

https://beta.openai.com/docs/guides/images/introduction より

また、下記のように生成する画像のサイズごとに料金が決まっており、新規ユーザーに提供される無料トークンは$18分、3か月で失効する点はご注意ください。


https://openai.com/api/pricing/ より

To explore and experiment with the API, all new users get free $18 worth of free tokens. These tokens expire after 3 months.

After the quota has passed you can choose to enter billing information to continue your use of the API. If no billing information is entered you will still have login access, but will be unable to make any further API requests.

https://help.openai.com/en/articles/4936830-what-happens-after-i-use-my-free-tokens-or-the-3-months-is-up-in-the-free-trial より

ジャパンバードフェスティバル2022に行ってきたよ。前のページ

2022年11月の人気記事次のページ

関連記事

  1. その他

    Microsoft Speech Platform Version 11が公開されました。

    今月1日、Microsoft Speech Platform Vers…

  2. その他

    Windows Azure MSDN 特典をアクティブ化しました。

    MSDN サブスクリプションの特典でWindows Azureが使える…

  3. ブックマークレット

    Bingで期間指定検索するオプション 他

    Bingで期間指定検索するオプション 他Bingで検索するとG…

  4. その他

    ブログリニューアルしました。

    といっても、WordPressのテンプレートを変えただけですが・・・。…

コメント

  • コメント (0)

  • トラックバックは利用できません。

  1. この記事へのコメントはありません。

Time limit is exhausted. Please reload CAPTCHA.

※本ページはプロモーションが含まれています。

Translate

最近の記事

アーカイブ

PAGE TOP