Using "gpt-4-vision-preview" for Image Interpretation from an Uploaded Folder

Hello everyone,

I am currently working on a project where I need to use GPT-4 to interpret images that are loaded from a specific folder. or when an user upload an image. My goal is to make the model analyze an uploaded image and provide insights or descriptions based on its contents.

Here’s the code snippet I am using:

if uploaded_image is not None:
    image =
    st.image(image, caption='Uploaded Image', use_column_width=True)
    response =
                "role": "user",
                "content": [
                    {"type": "text", "text": "What’s in this image?"},


I am facing challenges in getting this to work as intended. Has anyone here worked on a similar task or can offer guidance on how to correctly implement this feature using GPT-4? Any insights or suggestions would be greatly appreciated.

Thank you in advance for your help!

1 Like

OK, so “Images can are made available to the model in two main ways: by passing a link to the image or by passing the base64 encoded image directly in the request.” Thank you @wclayf

1 Like