0% found this document useful (0 votes)
48 views11 pages

05 Generate Images With Azure OpenAI Service

Generate images with Azure OpenAI Service
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views11 pages

05 Generate Images With Azure OpenAI Service

Generate images with Azure OpenAI Service
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Introduction

• The Azure OpenAI service enables you to use large language models (LLMs) to
generate content based on natural language prompts.

• One of these models is the DALL-E image generation model, which is capable
of creating original graphical content based on natural language descriptions
of a desired image.

• The ability to use AI to generate graphics has a number of applications;


including the creation of illustrations or photorealistic images for articles or
marketing collateral, generation of unique product or company logos, or any
scenario where a desired image can be described.

• In this module, you'll learn how to use the DALL-E model in an instance of the
Azure OpenAI service, and retrieve the images it generates.
What is DALL-E?
• DALL-E is a neural network based model
that can generate graphical data from
natural language input.

• Put more simply, you can provide DALL-


E with a description and it can generate
an appropriate image.

• For example, you might submit the


following natural language prompt to
DALL-E: A squirrel on a motorcycle

• This prompt could result in the


generation of graphical output such as
the following image:
What is DALL-E?
• The images generated by DALL-E are original; they are not retrieved from a curated
image catalog.

• In other words, DALL-E is not a search system for finding appropriate images - it is
an artificial intelligence (AI) model that generates new images based on the data on
which it was trained.
Explore DALL-E in Azure OpenAI
Studio
• To experiment with DALL-E, you
can provision an Azure OpenAI
Service resource in an Azure
subscription that has been
approved for access to the
service, and use the DALL-E
playground to submit prompts
and view the resulting generated
images.
Explore DALL-E in Azure OpenAI
•Studio
When using the playground, you can adjust the settings to specify:

• The resolution (size) of the generated images. Available sizes are 256x256,
512x512, 1024x1024 (which is the default value), or 1024x1792.
• The image style to be generated (such as vivid or natural).
• The image quality (choose from standard or hd).
Use the Azure OpenAI REST API to consume DALL-
•E You
models
can use the Azure OpenAI service REST API to consume DALL-E models from
applications.

• To make a REST call to the service, you need the endpoint and authorization key for
the Azure OpenAI Service resource you have provisioned in Azure.

• You initiate the image generation process by submitting a POST request to the
service endpoint with the authorization key in the header.

• The request must contain the following parameters in a JSON body:

• prompt: The description of the image to be generated.


• n: The number of images to be generated.
• size: The resolution of the image(s) to be generated (256x256, 512x512,
or 1024x1024).
Use the Azure OpenAI REST API to consume DALL-
•E For
models
example, the following JSON could be used to generate an 512 x 512 image of
a badger wearing a tuxedo:

• The result from the initial request does not immediately return the results of the
image generation process.

• Instead, the response includes an operation-location header with a URL for a


callback service that your application code can poll until the results of image
generation are ready.

• When the operation has succeeded, a response similar to the following JSON is
returned:
Use the Azure OpenAI REST API to consume DALL-
E models

• The result element includes a collection of url elements, each of which


references a PNG image file generated from the prompt.

• In this example, the file might look similar to the following image:
Use the Azure OpenAI REST API to consume DALL-
E models
Exercise - Generate images with a DALL-
E model
Knowledge check
1. You want to use a model in Azure OpenAI to generate images. Which model
should you use?

a) DALL-E
b) GPT-35-Turbo
c) Text-Davinci
2. Which playground in Azure OpenAI Studio should you use to explore image
generation

d) Completions
e) Chat
f) DALL-E
3. In a REST request to generate images, what does the n parameter indicate?

g) The description of the desired image.


h) The number of images to be generated
i) The size of the image to be generated

You might also like