Hello,
Is it possible to provide an image directly from the PC (or the device where API is being used) instead of the URL of the image while using the chat completion API? To further illustrate, in the code below, the image input is provided via a URL, “image_url”. Instead of a URL, can we provide the path of an image stored in the memory of the device directly? Or are there any other solution where we use the image from the device without a need to a URL?
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4-vision-preview",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What’s in this image?"},
{
"type": "image_url",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
},
],
}
],
max_tokens=300,
)
print(response.choices[0])