Generate Images With Azure OpenAI DALL-E Postman

In this blog post, we will generate images with Azure OpenAI DALL-E service using Postman REST API.

DALL-E is an Azure OpenAI service that generates graphical images using user language input. All images generated by the DALL-E service are original, not from an internet catalogue like Google images.

We can create an image using the Postman API tool, C# or Python. In this post, we are going to use Postman.

Create OpenAI Resource

Before you start, ensure you have an Azure OpenAI resource deployed using the portal or Terraform and have the endpoint and Key available. Please visit this post for more details.

Generate and Retetive Image

Once you have the Azure OpenAI resource, endpoint and key available. Create two environment variables called

  • AZURE_OPENAI_ENDPOINT = Endpoint URL
  • AZURE_OPENAI_KEY = Azure openAI Key

To generate an image, create a new POST Postman request that looks like:

The body of the request needs to look like:

{
    "prompt": "infinity logo",
    "n": 1,
    "size": "512x512"
}

To customize the request, use the following.

  • Prompt = Generated image details
  • N = Number of images
  • Size = can be 512×512 , 250×250, 1024×1024

The output of the request will look like this.

{
  "id": " id details",
  "status": "notRunning"
}

Copy the number that appears next to the ID and create the following get request.

{{AZURE_OPENAI_ENDPOINT}}/openai/operations/images/{operation-id}?api-version=2023-06-01-preview

After you run the request, the output will retrieve the image’s URL.


Posted

in

, , ,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.