Unleashing the Power of Chat GPT Connector for Image Generation in Power Apps: Transforming Ideas…

OpenAI Chat GPT (Generative Pre-trained Transformer) is an advanced language model developed by OpenAI that uses machine learning to generate human-like text. It is capable of natural language processing tasks such as text completion, summarization, question-answering, and more. The GPT model is pre-trained on a massive amount of data and can be fine-tuned for specific applications. It has been used in various industries, including healthcare, finance, and media, to automate tasks and improve customer experience.

In this blog article I will guide you through the process of building a custom connector that leverages the OpenAI Chat GPT API to create custom actions using Image Generation model within Power Apps.

Potential use cases

In today’s fast-paced business landscape, providing personalized experiences that resonate with customers is the key to success. Imagine a solution that combines the power of advanced language generation and image creation to tailor offerings precisely to individual preferences. OpenAI’s Chat GPT, a cutting-edge language model, seamlessly integrated with Power Apps, opens the door to a world of possibilities across various industries.

E-Commerce Product Personalization

An e-commerce platform can use the solution to enhance the product browsing experience for customers. By collecting information about a customer’s preferences and using the GPT-powered custom connector, the platform can generate personalized product images showcasing items that match the customer’s style, color choices, and preferences. This can increase the likelihood of conversion and improve customer satisfaction.

Real Estate Virtual Tours

In the real estate industry, agents can create virtual property tours that cater to potential buyers’ preferences. By inputting details about what a customer is looking for in a property, the custom connector can generate virtual tour images that highlight the desired features of the property, such as interior design, view, and amenities.

Fashion and Apparel Suggestions

Fashion retailers can use this solution to provide personalized outfit suggestions to customers. Users can describe their upcoming events or personal style, and the GPT-powered system can create images of outfit combinations that match their criteria. This helps customers visualize their choices before making a purchase.

Event Planning and Decor

Event planners can leverage the solution to create visual representations of event setups and decorations. Customers can provide details about the theme, color scheme, and style of their event, and the custom connector can generate images of the venue decorated according to their specifications.

Interior Design Concepts

Interior designers can use the solution to develop visual concepts for their clients. Clients can describe their ideal living spaces, and the system can generate images showcasing furniture arrangement, color schemes, and decor ideas that align with the client’s preferences.

Automotive Customization

Car dealerships or enthusiasts can use the solution to visualize customized vehicles. Customers can specify modifications they want, and the system can generate images of the vehicle with the requested modifications, such as new paint colors, wheels, and accessories.

Requirements

If you’re a beginner to Power Platform, it’s important to note that you need a valid license to use these tools. Fortunately, Microsoft offers a program called the Microsoft 365 Developer Account, which is available to anyone who wants to learn and develop solutions using Microsoft 365 apps. By signing up for this program, you’ll gain access to a suite of Microsoft 365 apps that will help you hone your skills and create solutions like the custom connector we’ll be building in this blog post. So, if you haven’t already, sign up for a Microsoft 365 Developer Account here

Navigate to OpenAI’s platform, which is a cloud-based platform for developing and deploying AI applications. The platform offers various AI tools and services, including language models, machine learning algorithms, and APIs for natural language processing, image recognition, and more.

For this demo we will start with image generation. OpenAI’s Chat GPT can also be used for image generation by conditioning the model with textual prompts. The model can generate images based on textual descriptions, which can be useful in various applications such as generating images from text descriptions or improving image search results. The image generation capabilities of Chat GPT are made possible by a technique called GAN (Generative Adversarial Networks). You can read more about it here

So, lets create a custom connector to leverage this API. Navigate to Power Apps, click on More and then click on Discover all.

Under the Data section we can see custom connectors. Click on Custom connectors to view all custom connectors available.

Currently we have no custom connectors. Click on New custom connector and create from blank to start creating one.

Give the connector a name and click continue.

On the general information settings, you can upload an icon, configure background color, provide a description and host.

For security settings, set the authentication type to API Key. This will reveal API Key configuration parameters. Parameter label should be set to API Key and Parameter name to Authorization.

Navigate to definition and click the + New action button to create a new action. Provide a summary, description and operation ID.

Under request below, click on import from sample. Please see the following configurations below (Click import button below when complete):

Verb: POST

URL: https://openai.com/v1/images/generations

Headers: Content-Type: application/json

Body:

{

“prompt”: “a white siamese cat”,

“n”: 1,

“size”: “1024×1024”

}

Under Request click on content type and edit.

Set the default value to application/json, set required to Yes and visibility to internal. Once done, click back to go back to definition.

Under request click on body to edit.

Set required to Yes and visibility to Internal. We will then modify the n, prompt and size properties.

Set the following properties for n (Number of Images) as shown below. Click back once complete.

Set the following properties for prompt (Text to generate Images) as shown below. Click back once complete.

Set the following properties for size (Image Size) as shown below. Click back once complete.

Click create to create the connector.

Next, lets go ahead and test the connector. First, we would need to create a new connection.

You would be prompted to add the API key would be in the format of Bearer {API Key}

You can generate a new API Key on the Open AI platform. Sign in or create an account if you haven’t already. Navigate to View API Keys.

Click create new secret key. Once generated copy this API key

Paste this key in the connection configuration with the format as shown below Bearer {API Key}

Once your connection is successfully added you should see a new connection selected with a timestamp. Now you ready to test your custom connector. In the prompt text box enter a description of the image you want to be generated. For this test I would be using the key text “Panda wearing a scarf and a top hat realistic”

Scroll down and you will see a generated link to an image. Copy this and paste into a new browser tab.

Congratulations! You have successfully learned how to create a Chat GPT Connector in Power Apps for image generation. By following the simple steps outlined in this article, you can now easily generate images within your Power Apps application, enhancing the user experience and streamlining your image generation process. This powerful tool can help you to bring your ideas to life more efficiently and effectively, unlocking a world of creativity and possibilities. With the Chat GPT Connector, you can take your Power Apps application to the next level and achieve your goals with ease. Keep exploring and innovating, and congratulations again on your accomplishment!