Architecture overview
This solution architecture has two types of AI feature implementations: architecture based on AWS Lambda and architecture based on Amazon SageMaker.
Architecture based on AWS Lambda

- 
The user or application sends an API request to the Amazon API Gateway. The request payload needs to contain information about the image or text to be processed. 
- 
Amazon API Gateway sends the incoming user request directly to the AWS Lambda function. 
- 
The AWS Lambda function returns the result to the invoker. 
Architecture based on Amazon SageMaker

- 
The user or application sends an API request to the Amazon API Gateway. The request payload needs to contain the image or text information to be processed. 
- 
Amazon API Gateway sends the request to AWS Lambda (invoke endpoint) function. 
- 
AWS Lambda invokes Amazon SageMaker Endpoint, which performs the inference process in Amazon SageMaker and returns the inference result (usually in JSON format data).