AWS Machine Learning Blog 2024年09月19日
Revolutionize logo design creation with Amazon Bedrock: Embracing generative art, dynamic logos, and AI collaboration
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了如何使用 AWS 和 Stable Diffusion 的图像到图像模型,创建交互式工具来生成和编辑艺术和徽标图像。该解决方案利用 Amazon Bedrock API 来访问 Stable Diffusion 模型,并整合了各种 AWS 服务,包括 API Gateway、Lambda 和 S3,提供了一个完整的流程来处理用户输入、生成图像并显示结果。

🤔该解决方案利用了 Stable Diffusion 的图像到图像模型,该模型可以根据文本描述、图像或其他输入生成图像。它首先将文本转换为数值,总结提示,然后使用这些数值生成图像表示。最后,它将图像表示缩放到高分辨率图像。

🚀该解决方案利用 Amazon Bedrock API 访问 Stable Diffusion 模型,并整合了各种 AWS 服务,包括 API Gateway、Lambda 和 S3,提供了一个完整的流程来处理用户输入、生成图像并显示结果。

💻该解决方案的架构包括一个前端用户界面、API Gateway、Lambda 函数和 Amazon S3 存储桶。用户可以通过前端用户界面提供文本提示和图像,并使用 API Gateway 将请求发送到 Lambda 函数。Lambda 函数使用 Amazon Bedrock API 访问 Stable Diffusion 模型,生成图像并将其存储在 Amazon S3 存储桶中。然后,前端用户界面从 Amazon S3 存储桶中检索生成的图像并将其显示给用户。

💡该解决方案使用户能够通过提供文本提示和图像来创建和编辑艺术和徽标图像。该解决方案提供了多种功能,例如从文本提示生成图像、将图像与文本提示相结合以生成新的图像,以及使用生成的图像作为参考图像以进行进一步的编辑。

🎨该解决方案可用于各种用例,例如广告和营销、媒体和娱乐以及产品设计。它可以帮助企业创建引人入胜的图像,并使它们能够快速迭代和改进其设计。

🌎该解决方案展示了如何利用 AWS 和 Stable Diffusion 的力量来构建创新的应用程序,这些应用程序可以帮助用户创建和编辑图像,并推动创造力和设计的新边界。

In the field of technology and creative design, logo design and creation has adapted and evolved at a rapid pace. From the hieroglyphs of ancient Egypt to the sleek minimalism of today’s tech giants, the visual identities that define our favorite brands have undergone a remarkable transformation.

Today, the world of creative design is once again being transformed by the emergence of generative AI. Designers and brands now have opportunities to push the boundaries of creativity, crafting logos that are not only visually stunning but also responsive to their environments and tailored to the preferences of their target audiences.

Amazon Bedrock enables access to powerful generative AI models like Stable Diffusion through a user-friendly API. These models can be integrated into the logo design workflow, allowing designers to rapidly ideate, experiment, generate, and edit a wide range of unique visual images. Integrating it with the range of AWS serverless computing, networking, and content delivery services like AWS Lambda, Amazon API Gateway, and AWS Amplify facilitates the creation of an interactive tool to generate dynamic, responsive, and adaptive logos.

In this post, we walk through how AWS can help accelerate a brand’s creative efforts with access to a powerful image-to-image model from Stable Diffusion available on Amazon Bedrock to interactively create and edit art and logo images.

Image-to-image model

The Stability AI’s image-to-image model, SDXL, is a deep learning model that generates images based on text descriptions, images, or other inputs. It first converts the text into numerical values that summarize the prompt, then uses those values to generate an image representation. Finally, it upscales the image representation into a high-resolution image. Stable Diffusion can also generate new images based on an initial image and a text prompt. For example, it can fill in a line drawing with colors, lighting, and a background that makes sense for the subject. Stable Diffusion can also be used for inpainting (adding features to an existing image) and outpainting (removing features from an existing image).

One of its primary applications lies in advertising and marketing, where it can be used to create personalized ad campaigns and an unlimited number of marketing assets. Businesses can generate visually appealing and tailored images based on specific prompts, enabling them to stand out in a crowded marketplace and effectively communicate their brand message. In the media and entertainment sector, filmmakers, artists, and content creators can use this as a tool for developing creative assets and ideating with images.

Solution overview

The following diagram illustrates the solution architecture.

This architecture workflow involves the following steps:

    In the frontend UI, a user chooses from one of two options to get started:
      Generate an initial image. Provide an initial image link.
    The user provides a text prompt to edit the given image. The user chooses Call API to invoke API Gateway to begin processing on the backend. The API invokes a Lambda function, which uses the Amazon Bedrock API to invoke the Stability AI SDXL 1.0 model. The invoked model generates an image, and the output image is stored in an Amazon Simple Storage Service (Amazon S3) bucket. The backend services return the output image to the frontend UI. The user can use this generated image as a reference image and edit it, generate a new image, or provide a different initial image. They can continue this process until the model produces a satisfactory output.

Prerequisites

To set up this solution, complete the following prerequisites:

    Pick an AWS Region where you want to deploy the solution. We recommend using the us-east-1 Obtain access to the Stability SDXL 1.0 model in Amazon Bedrock if you don’t have it already. For instructions, see Access Amazon Bedrock foundation models. If you prefer to use a separate S3 bucket for this solution, create a new S3 bucket. If you prefer to use localhost for testing the application instead of Amplify, make sure python3 is installed in your local machine.

Deploy the solution

To deploy the backend resources for the solution, we create a stack using an AWS CloudFormation template. You can upload the template directly, or upload it to an S3 bucket and link to it during the stack creation process. During the creation process, provide the appropriate variable names for apiGatewayName, apiGatewayStageName, s3BucketName, and lambdaFunctionName. If you created a new S3 bucket earlier, input that name in s3BucketName – this bucket is where output images are stored. When the stack creation is complete, all the backend resources are ready to be connected to the frontend UI.

The frontend resources play an integral part in creating an interactive environment for your end-users. Complete the following steps to integrate the frontend and backend:

    When the CloudFormation stack deployment is complete, open the created API from the API Gateway console.

    Choose Stages in the navigation pane, and on the Stage actions menu, choose Generate SDK.

    For Platform, choose JavaScript.

    Download and unzip the JavaScript SDK .zip file, which contains a folder called apiGateway-js-sdk. Download the frontend UI index.html file and place it in the unzipped folder.

This file is configured to integrate with the JavaScript SDK by simply placing it in the folder.

    After the index.html is placed in the folder, select the content of the folder and compress it into a .zip file (don’t compress the apiGateway-js-sdk folder itself.)

    On the Amplify console, choose Create new app. Select Deploy without Git, then choose Next.

    Upload the compressed .zip file, and change the application name and branch name if preferred. Choose Save and deploy.

The deployment will take a few seconds. When deployment is complete, there will be a domain URL that you can use to access the application. The application is ready to be tested at the domain URL.

CloudFormation template overview

Before we move on to testing the solution, let’s explore the CloudFormation template. This template sets up an API Gateway API with appropriate rules and paths, a Lambda function, and necessary permissions in AWS Identity and Access Management (IAM). Let’s dive deep into the content of the CloudFormation template to understand the resources created:

Lambda function explanation

Let’s dive into the details of the Python code that generates and manipulate images using the Stability AI model. There are three ways of using the Lambda function: provide a text prompt to generate an initial image, upload an image and include a text prompt to adjust the image, or reupload a generated image and include a prompt to adjust the image.

The code contains the following constants:

handler(event, context) is the main entry point for the Lambda function. It processes the input event, which contains the promptInput and actionInput parameters. Based on the actionInput, it performs one of the following actions:

The function generate_image_with_bedrock(prompt, init_image_b64=None) generates an image using the Amazon Bedrock runtime service, which includes the following actions:

To obtain a more personalized outputs, the hyperparameter values in the function can be adjusted:

Test and evaluate the application

The following screenshot shows a simple UI. You can choose to either generate a new image or edit an image using text prompts.

The following screenshots show iterations of sample logos we created using the UI. The text prompts are included under each image.

Clean up

To clean up, delete the CloudFormation stack and the S3 bucket you created.

Conclusion

In this post, we explored how you can use Stability AI and Amazon Bedrock to generate and edit images. By following the instructions and using the provided CloudFormation template and the frontend code, you can generate unique and personalized images and logos for your business. Try generating and editing your own logos, and let us know what you think in the comments. To explore more AI use cases, refer to AI Use Case Explorer.


About the authors

Pyone Thant Win is a Partner Solutions Architect focused on AI/ML and computer vision. Pyone is passionate about enabling AWS Partners through technical best practices and using the latest technologies to showcase the art of possible.

Nneoma Okoroafor is a Partner Solutions Architect focused on helping partners follow best practices by conducting technical validations. She specializes in assisting AI/ML and generative AI partners, providing guidance to make sure they’re using the latest technologies and techniques to deliver innovative solutions to customers.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

AWS Stable Diffusion 图像生成 徽标设计 AI 艺术
相关文章