見出し画像

GrokのFLUX.1と有料サービスのFLUX.1 Proについて

※ Last update 8-31-2024
※ (8-31) 現在は「Grok 2」「Grok 2 mini」「画像の生成(成功時をカウント)」いずれも2時間あたり50回までのようです。
※ 2-6. Tips(?) を追加しました。
※ アニメ調の画像ばかりを生成していますが、リアル系ももちろん生成できます(むしろそちらの方が得意)。




■ 0. 概要

▼ 0-0. 本記事について

 本記事では、下記の内容を掲載しています。

  • 8-14-2024に登場したX上のGrok 2.0で、FLUX.1の画像生成を試してみた例。

  • 有料サービスでFLUX.1 Proを利用してみた例。



■ 1. XのGrok 2.0にFLUX.1が搭載


▼ 1-1. 初出の情報

 調べた限りでは8-14-2024の未明(日本時間)に、Grok 2.0とFLUX.1の実装に関する最も古いポストがありました(5.と6.の箇所)。日本では、この日の午後あたりから話題になり始めます。

 下記URLは公式なリリースで、Grok 2上でFLUX.1のモデルを実験している旨が記載されています。


▼ 1-2. Grok上のFLUX.1に関する仕様

 8-14-2024の午後(日本時間)の時点で判明している主な仕様です。

  • Grok(画像の生成を含む)は、プレミアムまたはXプレミアムプラスのプランで利用可能。

  • モデルは不明だが、FLUX.1 Proの可能性がある(意外と高性能?雰囲気的にはDev以上Pro未満)。

  • プロンプトは半角英字(1バイト文字)で500文字までとみられる(超えた分は切り捨て)。

  • プレミアムでは2時間あたり50回まで生成できる模様(※ 8-31現在、当初は20回まで)。Xプレミアムプラスではさらに多い可能性がある。

  • 画像の解像度は1024x768で、JPG形式

  • 電子透かしの類は無し?



■ 2. Grok上での画像の生成方法


▼ 2-1. 生成の方法(日本語)

 下記のようにカギ括弧付きで指示をするのが簡単です。基本的に、指示した内容を直訳したプロンプトで生成されます。プロンプトを勝手に調整するChatGPTのDALL·E 3とは対照的です。

「アニメ調の水彩画で一輪の花を持つ女の子」を生成

 たまに生成しない場合があるので、もう少し明確にすると確実です。

「アニメ調の水彩画で一輪の花を持つ女の子」の画像を生成
日本語で生成を行った


▼ 2-2. 生成の方法(英語1)

 英語の場合は、プロンプトを直接与える形になります。

generate an image of "This is a face close-up shot, pastel colored, Japanese anime style artwork. There is a mother and her pre-teen daughter holding hands, make smiile , closed mouth and looking at each other with joy in a bustling daytime fantasy theme park. The daughter wearing a detailed pink magical princess costume. The mother wearing white blouse and navy long apron dress. There is the park under the bright summer sun, with colorful attractions, exciting rides, and lively food stalls. The mother's eyes sparkle with love and pride as she shares this special moment with her daughter. The background is filled with the hustle and bustle of the crowd, creating a sense of excitement and wonder. Include details like balloons floating in the clear blue sky, children running around with ice cream cones, and park mascots greeting visitors."

 下記の形式でも大丈夫そうです。

generate image: This is a face close-up shot, pastel colored, Japanese anime style artwork. There is a mother and her pre-teen daughter holding hands, make smiile , closed mouth and looking at each other with joy in a bustling daytime fantasy theme park. The daughter wearing a detailed pink magical princess costume. The mother wearing white blouse and navy long apron dress. There is the park under the bright summer sun, with colorful attractions, exciting rides, and lively food stalls. The mother's eyes sparkle with love and pride as she shares this special moment with her daughter. The background is filled with the hustle and bustle of the crowd, creating a sense of excitement and wonder. Include details like balloons floating in the clear blue sky, children running around with ice cream cones, and park mascots greeting visitors.

 上記の指示で生成できましたが、生成後に表示されたプロンプトが途中で切れています。切れた部分に書かれていた風船やマスコットも登場していません。どうやら、生成に使用されるプロンプトは500文字までのようです。

プロンプトの500文字を超えた部分が切り捨てられている


▼ 2-3. 生成の方法(英語2)

 FLUX.1のプロンプトは自然言語(英文)で表現しますが、カンマ区切りの表現も受け入れられます。要素の詰め込みはこちらの方が有利かもしれません。

generate an image of below:
anime style, cowboy shot, child 1girl, smile, open mouth, white sailor uniform, light blue hair, long wavy hair, navy blue pleat skirt, shiny purple eyes, red tie, sitting on bed, pigeon-toed, white socks, kawaii bedroom, cluttered books, starry through window, night, toy mech cat

 下記の形式でも大丈夫そうです。途中に改行があっても構いません。

generate image:
anime style, cowboy shot, child 1girl, smile, open mouth, white sailor uniform, light blue hair, long wavy hair, navy blue pleat skirt, shiny purple eyes, red tie, sitting on bed, pigeon-toed, white socks, kawaii bedroom, cluttered books, starry through window, night, toy mech cat
カンマ区切りのプロンプトを使用した


▼ 2-4. 生成の方法(日本語2)

 生成が確実にできる方法では無いので、なるべく次項を参照してください。文章を先に作らせる方法の利点は、指示した内容よりも多くの情報を用いて生成ができることです。

女の子とお母さんがプールで遊ぶシーンの描写をanimeで始まる3センテンスの英文でお願いします

いまの英文で生成してください
「女の子とお母さんがプールで遊ぶシーン」と「anime」の提示のみで生成できた


▼ 2-4b. 生成の方法(日本語→英語)

 2-4.の方法を応用しようとしましたが、少し変更するだけでプロンプトの引き渡しが正確に行えなくなりました。面倒でも、プロンプトを書かせてから、コピー&ペーストで添えて指示する方が確実です。

"FLUX.1 on Grok"と書かれたボードを持ったセーラー服の女の子が登場するシーンをanimeで始まる3センテンスの英文でお願いします

generate image:
Anime: A girl in a sailor uniform steps into the frame, her eyes wide with determination. She holds up a board that reads "FLUX.1 on Grok", her expression a mix of pride and mischief. The scene bursts into a kaleidoscope of colors as she declares, "Let's get this party started!"
文を考案させてからプロンプトとして渡して生成を指示した


▼ 2-5. 生成の方法(おまけ)

 最後に既知のアイデアを紹介します。FLUX.1はプロンプトへの追従性の高さだけではなく、文字の出力も得意です。様々な場所に文字を入れることができるので、遊んでみてください。

generate an image of below:
4-panel manga, watercolor on textured paper.
Panel 1: Girl with ponytail enters dessert buffet, eyes wide. "Wow! Dessert heaven!"
Panel 2: Close-up of excited girl piling sweets. "I want to try everything!"
Panel 3: Girl at table, plate full. Bites shortcake. "Nom!"
Panel 4: Girl leans back, patting full belly. Empty plates around. "Maybe I overdid it..." Sweat drop visible.
4コマ漫画に発言を入れてみた


▼ 2-6. Tips(?)

 生成していて気づいた点を挙げておきます。ご参考まで。

  • 対話の繰り返しでも生成できるが、プロンプトはシンプルで短めになる。それで良ければ、ChatGPTやCopilotと同じように話しかければ良い。

  • 指示と応答のプロンプトが完全一致しない場合がある。基本的には、変更されてもわずかで影響は少ない。ただし、一部の表現が削られてしまうケースも確認している(一部のチャットにて発生を確認)。

  • 画像を生成しなかったのに「I generated~」と応答した場合は、実際にはプロンプトが拒否されている可能性が高い。指示を少し書き換えると生成できる場合がある。

  • 画像を生成せず、内容に関する長文を返してくる場合も同様の可能性がある。

  • 「Something went wrong while responding to your request.」が出た場合は、リトライで生成できる可能性がある。成功の確率はプロンプトによる。

  • まれに、生成枚数の上限に達した旨の、偽の応答を繰り返す場合がある。別のチャットで指示を行えば問題ない。



■ 3. Grokで生成した画像

 さきほどの画面に登場した画像とプロンプトを掲載します。

Anime-style watercolor painting of a girl holding a single flower

 下記画像のプロンプトは途中で切れています。切れていない場合の生成例は別記事の5-3.を参照。

This is a face close-up shot, pastel colored, Japanese anime style artwork. There is a mother and her pre-teen daughter holding hands, smiling, closed mouth and looking at each other with joy in a bustling daytime fantasy theme park. The daughter wearing a detailed pink magical princess costume. The mother wearing white blouse and navy long apron dress. The park under the bright summer sun, with colorful attractions, exciting rides, and lively food stalls. The mother's eyes sparkle with love and
anime style, cowboy shot, child 1girl, smile, open mouth, white sailor uniform, light blue hair, long wavy hair, navy blue pleat skirt, shiny purple eyes, red tie, sitting on bed, pigeon-toed, white socks, kawaii bedroom, cluttered books, starry through window, night, toy mech cat
Anime scene of a little girl with pigtails and a bright pink swimsuit splashing in a sparkling pool, her laughter echoing like bells, with her mother watching and joining in, creating ripples that reflect the summer sun.
Anime: A girl in a sailor uniform steps into the frame, her eyes wide with determination. She holds up a board that reads "FLUX.1 on Grok", her expression a mix of pride and mischief. The scene bursts into a kaleidoscope of colors as she declares, "Let's get this party started!
4-panel manga, watercolor on textured paper. Panel 1: Girl with ponytail enters dessert buffet, eyes wide. "Wow! Dessert heaven!" Panel 2: Close-up of excited girl piling sweets. "I want to try everything!" Panel 3: Girl at table, plate full. Bites shortcake. "Nom!" Panel 4: Girl leans back, patting full belly. Empty plates around. "Maybe I overdid it..." Sweat drop visible.



■ 4. FLUX.1 Proが利用できるサービス


▼ 4-1. 概要

 FLUX.1 Proを利用して画像の生成ができるサービスを紹介します(無知なので、他にもっと良い条件のところがあったらすみません)。いずれも、サインインのためにGitHubのアカウントが必要です。


▼ 4-2. Replicate

https://replicate.com/black-forest-labs/flux-pro 

ReplicateのFLUX.1 Pro用のUI

 料金は https://replicate.com/pricing に掲載されています。先にクレジットカードを登録する必要がありますが、後払いのようです。$1単位でSpend limitを設定できるので安心です。 

画像生成の料金

 FLUX.1 Proは1枚あたり$0.055、$1で18枚ほどの生成ができます。画像のサイズは自由に設定できず、プリセットのアスペクト比から選択します。16:9では1344x768でした。

画像のサイズではなくアスペクト比を選択できる

 生成した画像を掲載しておきます。

A cheerful anime girl with long, flowing dark brown hair, crouching with knees pulled close. She's wearing a cute outfit: a pastel pink frilly blouse draping over her knees, and a white tulle mini skirt with lace trim. Her bow-accented ankle boots are visible as she balances on her toes. Viewed diagonally, her bright eyes and warm smile are prominent as she looks at the viewer with friendliness and curiosity. Behind her, an alpine meadow stretches out, dotted with wildflowers. Snow-capped Alps pierce the sky, with a quaint resort town in the valley. The late afternoon sun casts a warm glow, highlighting her silhouette. The image is in a soft, watercolor style, emphasizing the dreamy atmosphere of the scene.

 Replicateは、「Dashboard」から履歴が確認できます。最初にアクセスした際は簡単な内容に回答する必要があります。その後、「Recent predictions」に表示されたIDのリンク先へ進むと、過去に生成した画像が再度表示できます。「Predictions」のタブでも構いません。

過去の履歴


▼ 4-3. fal

https://fal.ai/models/fal-ai/flux-pro 

falのFLUX.1 Pro用のUI

 料金は https://fal.ai/pricing に掲載されています。初めは$1に達するまではお試しができて、その後は予算を決めて先払いするようです。そのため、クレジットカードの登録はまだ行っていません。

画像生成の料金

 FLUX.1 Proは1MPあたり$0.05です。画像のサイズをプリセットまたはカスタムから選択できます。生成UI上に単価が表示されます。

画像のサイズはプリセットまたはカスタムを選択できる

 生成した画像を掲載しておきます。

プロンプトは先ほどと同様

 falは「Requests」のタブから履歴が確認できます。「▶」のボタンをクリックすると過去に生成した画像が再度表示できます。

過去の履歴



■ 5. その他

 私が書いた他の記事は、メニューよりたどってください。

 noteのアカウントはメインの@Mayu_Hiraizumiに紐付けていますが、記事に関することはサブアカウントの@riddi0908までお願いします。

この記事が気に入ったらサポートをしてみませんか?