Skip to content

An easy way to query open ai api with vision capability using python

Notifications You must be signed in to change notification settings

ucscode/Python-GPTQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to use

from packages.vision import Vision
from packages.gpt_chat import GPTChat
from PIL import Image

chat = GPTChat()

# set initial system message
chat.set_system_context('You are a helpful assistant')

# start conversation
chat.add_assistant('How can I help you today')

chat.add_user('Well I need you to check an image for me')

chat.add_assistance('Please upload the image for inspection and state your requirement')

chat.add_user([
    'I would like you to tell me what is in the following image',
    Image.open('image.png', 'r'),
])

# initialize vision

vision = Vision()

response = vision.query_gpt(chat, max_token=300)

response.choices[0].message.content

About

An easy way to query open ai api with vision capability using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages