AWS bedrock documentation change
Summary
Added image base64 encoding and parameter handling for creative upscaling API
Security assessment
Change demonstrates image processing workflow but doesn't reference security fixes or document security features. Standard documentation improvement.
Diff
diff --git a/bedrock/latest/userguide/model-card-stability-ai-stable-image-creative-upscale.md b/bedrock/latest/userguide/model-card-stability-ai-stable-image-creative-upscale.md index abd95effe..1b75e792a 100644 --- a//bedrock/latest/userguide/model-card-stability-ai-stable-image-creative-upscale.md +++ b//bedrock/latest/userguide/model-card-stability-ai-stable-image-creative-upscale.md @@ -134,0 +135 @@ Invoke API + import base64 @@ -137,0 +139,3 @@ Invoke API + with open('input.png', 'rb') as f: + image_base64 = base64.b64encode(f.read()).decode('utf-8') + params = {'image': image_base64, 'prompt': 'high quality detailed image'} @@ -140,4 +144 @@ Invoke API - body=json.dumps({ - 'messages': [{ 'role': 'user', 'content': 'Can you explain the features of Amazon Bedrock?'}], - 'max_tokens': 1024 - }) + body=json.dumps(params) @@ -145 +146,2 @@ Invoke API - print(json.loads(response['body'].read())) + response_body = json.loads(response['body'].read()) + print(f'Image generated: {len(response_body["images"][0])} bytes (base64)')