Pecximenes's picture
Removing diretory and organazing files
94e320d
raw
history blame
1.32 kB
from openai import Client
def get_description_of_image(oa_client: Client, image_url):
completion = oa_client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "system",
"content": """
You are an image descriptor who will describe images using the Brazilian Portuguese language.
This description should be short and to the point, with a maximum of 50 characters, to be placed in the alt tag of an HTML.
""" # noqa
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "What's in this image?"
},
{
"type": "image_url",
"image_url": {
"url": f"{image_url}"
}
}
]
}
],
max_tokens=300
)
return completion.choices[0].message.content