Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbalcaen committed May 3, 2024
1 parent bd98a02 commit 2e46bb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lambdas/bedrock_invoker_2/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def lambda_handler(event, context):

for s3_uri in s3_uris:
bucket, key = s3_uri.replace("s3://", "").split('/', 1)
extension = os.path.splitext(key)[1]
extension = os.path.splitext(key)[1].lower()

try:
print(f"Fetching file bucket: {bucket}, key: {key}")
Expand All @@ -36,7 +36,7 @@ def lambda_handler(event, context):
elif extension in ['.jpg', '.png', '.jpeg']:
image_data = s3_object['Body'].read()
encoded_image_data = base64.b64encode(image_data).decode()
media_type = f'image/{'png' if extension == '.png' else 'jpeg'}'
media_type = f"image/{'png' if extension == '.png' else 'jpeg'}"
user_prompt_content.append({
'type': 'image',
'source': {'type': 'base64', 'data': encoded_image_data, 'media_type': media_type}
Expand Down

0 comments on commit 2e46bb5

Please sign in to comment.