Add support of encoded image url

This commit is contained in:
Aiden Dai
2024-04-10 09:49:48 +08:00
parent 81716238ec
commit f11a95cc19

View File

@@ -191,12 +191,12 @@ class ClaudeModel(BedrockModel):
# Send a request to the image URL # Send a request to the image URL
response = requests.get(image_url) response = requests.get(image_url)
# Check if the request was successful
if response.status_code == 200:
content_type = response.headers.get('Content-Type') content_type = response.headers.get('Content-Type')
if not content_type.startswith("image"): if not content_type.startswith("image"):
content_type = "image/jpeg" content_type = "image/jpeg"
# Check if the request was successful
if response.status_code == 200:
# Get the image content # Get the image content
image_content = response.content image_content = response.content
# Encode the image content as base64 # Encode the image content as base64