Last active
November 7, 2023 03:00
-
-
Save jimmyliao/af6fe01717531642984fc57e14c0b57b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
import os | |
import requests | |
from openai import OpenAI | |
client = OpenAI( | |
api_key=os.environ["OPENAI_API_KEY"], | |
) | |
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": "<YOUR_IMAGE_URL>", | |
}, | |
], | |
} | |
], | |
max_tokens=300, | |
) | |
print(response.choices[0].message.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment