ChatGPT + Midjourney: Few Shot Prompt Creation

Want to take your AI image generation from basic to photo-realistic? ChatGPT can help.

The first image is generated using the simple prompt: a happy family scene in a meadow --v 5

The second image is generated using the simple prompt - a happy family scene in a meadow fed to a few-shot trained ChatGPT and prompted for a midjourney prompt. ChatGPT gives us this expanded prompt:

a happy scene of a family in a meadow, parents holding hands, children running and playing, green grass, blue sky, sunshine, vibrant colors, joyful expressions, panoramic view, cinematic lighting, highly realistic, naturalistic style" --v 5 --ar 2:3 --chaos 30 --quality 1 --seed 123 --stylize 500 --uplight --v 5


How to do this yourself:

One of the more popular techniques we are seeing in image generation is the use of ChatGPT or GPT3/4 APIs in tandem with image generation tools like Midjourney or Dall-E. Learning image prompting can be difficult, especially for those of us without background in design or photography who lack the descriptives to efficiently describe the image outputs we want.

Step 1: Give Chat GPT some background on MidJourney. We included pages on parameters from documentation and a description:

  • Parameter List: https://docs.midjourney.com/docs/parameter-list

  • V5 Tag Instruction

Teaching ChatGPT Midjourney

Step 2: Find some images styles you like (with similar desired styling) on PromptHero (or other prompt showcase) with verbose prompts

  • Example 1: “portrait photo of an open and proud looking, beautiful model like gaelic woman, long curly ginger colored hair with curls, wearing heavy chain armor, on a very bright and sunny day, georgeous face details, cinematic lighting, very high detailed, 8k, foggy background, freckles, symmetrical face, artstation, sun lit face”

  • Example 2:”mdjrny-v4 style, girl in the distance, girl view from the back, medium length white hair, a young girl wearing white vintage dress, rocky coast by the sea, green cape, proportional body, a highly detailed face , girl running, panoramic view, top viev, toned body, cinematic lighting, depth of field, photography”

Step 3: Ask ChatGPT to generate a prompt from a simple description

Now that we’ve given ChatGPT some background, we can ask it to help with prompt generation.

Bonus: Extending this approach to APIs:

This approach is called “Few Shot” learning because we provide the AI with several examples of the task we want to replicate, rather than asking for a response with no examples (zero-shot).

The same technique can be used for programmatic workflows where the GPT prompt writing can be automated. The only difference here is that you can’t take advantage of the memory in ChatGPT to teach GPT to write Midjourney prompts, so you need to create a template that can do this in 1 shot. If you are using GPT3/3.5 this will give you ~4000 tokens of examples and background. For GPT4 you now have up to 32,000 though the cost will be significantly higher. While Midjourney does not have a public API, we can help implement this by using the Discord API or by using a similar approach with DALL·E 2.

The single prompt approach would use a template with example like the one below:

Full Prompt:

I want you to create a Midjourney prompt using the background information and examples below:

{Background Information}

{Example 1} {Example2} {Example3}

Create a midjourney prompt that will create an image of {simple prompt}

That’s it! You should get a improved prompted like the one in the ChatGPT image above. Hope this technique elevates your image creation skills.

Reach out to us at info@genaipartners.com if you want to build a composite image generation flow into your product or workflow.

Previous
Previous

Using LLMs for market feedback

Next
Next

Three Myths of LLM-based Application Limitations