[SEO Subhead]
This Guidance demonstrates how an AI-generated virtual personal stylist can provide a convenient and personalized styling experience for retail consumers. The AI stylist uses advanced machine learning to instantly deliver tailored outfit recommendations by analyzing a user's style, body type, location, weather, and other contextual factors to suggest outfits that are highly personalized to that specific consumer. This allows the AI technology to provide styling recommendations at any time, without the constraints of human availability, delivering a highly convenient and customized styling experience for users seeking instant access to personalized fashion advice.
Please note: [Disclaimer]
Architecture Diagram
[Architecture diagram description]
Step 1
The application is hosted on AWS Fargate for Amazon Elastic Container Service (Amazon ECS), served through Amazon CloudFront, and coupled with AWS WAF.
Step 2
The user authenticates to the application through Amazon Cognito user pools. The application retrieves an API key, URL, and Amazon Cognito user pool ID from AWS Secrets Manager.
Step 3
The user query is sent to Amazon API Gateway using an API URL and key stored in Secrets Manager.
Step 4
An AWS Lambda Text generation function, routed through /text, is invoked to call Agents for Amazon Bedrock.
Step 5
Agents for Bedrock use the user’s location to determine weather conditions and responds with styling recommendations. It uses data stored in Amazon Simple Storage Service (Amazon S3). This data is indexed in Amazon OpenSearch Serverless using Knowledge Bases for Amazon Bedrock.
Step 6
When the user initiates a request to generate an image, the /image routing triggers a Lambda Image generation function.
Step 7
The Lambda Image generation function queries the Amazon Bedrock Image generation model, which sends a Base64-encoded image back to the Lambda function. The image is subsequently fed back to API Gateway.
Step 8
When the user initiates the product search feature, the API Gateway invokes the /search endpoint, which searches for image embeddings stored in Amazon DynamoDB. Images stored in Amazon S3 trigger a Lambda function to create multi-modal image embeddings and insert them into the DynamoDB database.
Step 9
The Lambda function responsible for product image search creates query embeddings and uses cosine similarity to search for similar images from the DynamoDB database.
The top three ranked images are then returned as a response from API Gateway and displayed to the end user within the browser application.
Step 10
Product catalog ingestion pipeline: When the user uploads new product catalog files to an Amazon S3 bucket, a Lambda event is triggered that invokes a document ingestion job on the knowledge bases for Amazon Bedrock.
The knowledge bases for Amazon Bedrock then create a vector index within the vector database, specifically OpenSearch Serverless. As the data is stored and indexed in the vector database, it becomes searchable.
Step 11
Image ingestion pipeline: When the user uploads images from their fashion catalog to an Amazon S3 bucket, a Lambda event is triggered.
This event invokes the Amazon Titan Multimodal Embeddings G1 model, available on Amazon Bedrock, to create image embeddings for the incoming images. The generated image embeddings are then indexed and stored in DynamoDB.
Note
In production-ready applications, DynamoDB may be replaced with OpenSearch Serverless for the purpose of storing image embeddings.
Get Started
Deploy this Guidance
Well-Architected Pillars
The AWS Well-Architected Framework helps you understand the pros and cons of the decisions you make when building systems in the cloud. The six pillars of the Framework allow you to learn architectural best practices for designing and operating reliable, secure, efficient, cost-effective, and sustainable systems. Using the AWS Well-Architected Tool, available at no charge in the AWS Management Console, you can review your workloads against these best practices by answering a set of questions for each pillar.
The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.
-
Operational Excellence
The decoupled architecture of this Guidance promotes scalability and reliability. For example, API Gateway serves as the entry point for incoming requests, routing them to the appropriate Lambda functions for processing. Lambda enables the application to scale automatically based on demand without the need for manual infrastructure management. The Lambda functions are responsible for handling specialized tasks such as text generation, image generation, and product search. In addition, Amazon S3 and DynamoDB provide durable and scalable storage capabilities, with Amazon S3 supporting mostly unstructured data like images and DynamoDB managing structured data like user preferences and product information. Furthermore, OpenSearch Serverless is used as a vector database for the application's knowledge base, facilitating efficient and flexible information retrieval.
-
Security
Amazon Cognito provides secure user authentication and authorization, limiting application access to only authorized users and safeguarding their data. Secrets Manager securely stores sensitive credentials, protecting them from exposure in the application's code or configuration, while CloudFront improves website security with traffic encryption and access controls, and it integrates with AWS Shield Standard. Also, all AWS Identity and Access Management (IAM) policies have been scoped down to the minimum permissions required for the service to function properly.
-
Reliability
Elastic Load Balancing (ELB) routes traffic requests from the store’s mobile application to healthy Amazon Elastic Compute Cloud (Amazon EC2) instances. CloudFront distributes the Streamlit-based frontend globally, improving reliability and availability for users by caching content closer to their geographical locations. Furthermore, the incorporation of monitoring and observability through services such as CloudWatch enables the quick identification and resolution of any reliability issues that may arise.
-
Performance Efficiency
API Gateway, Lambda, Amazon S3, DynamoDB, and OpenSearch Serverless are designed to handle high-volume traffic, provide low-latency responses, and scale automatically to meet the application's evolving performance needs. Additionally, the global content delivery network of CloudFront reduces latency for users by caching content closer to them, improving the performance of the application.
-
Cost Optimization
The Lambda functions are charged based on the number of invocations and the duration of execution, enabling the application to scale up and down without incurring fixed infrastructure costs. Also, Amazon S3 and DynamoDB offer pay-as-you-go pricing models, where the user is only charged for the storage and throughput capacity they consume, without the need for upfront commitments. Furthermore, OpenSearch Serverless is a serverless offering, providing a cost-effective framework for running the application's knowledge base without the requirement to manage the underlying infrastructure. Additionally, CloudFront pricing is based on the volume of data transferred and the number of HTTP/HTTPS requests so that the user only pays for the resources they actually consume.
-
Sustainability
The Lambda functions are designed to automatically scale up and down based on demand so that only the minimum required resources are provisioned at any given time, thereby reducing overall energy consumption and waste. Amazon S3 and DynamoDB offer efficient data storage and retrieval patterns, minimizing the need for large, energy-intensive data centers and hardware. Furthermore, the global content delivery network of CloudFront serves to reduce the requirement for users to access data from distant data centers, improving energy efficiency by delivering content from locations closer to the end-user.
Related Content
[Title]
Disclaimer
The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.
References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between Amazon or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.