Image to text description

im trying to incorporate image detection into my discord bot . i want it to function how it does in the gpt-4 browser page. you give it a image and it tells you what the image is .

here is my current gpt-4 discord bot , very simply , how do incorporate the users being able to give the bot a image to describe?

import os 

import discord
import openai
from discord.ext import commands
from dotenv import load_dotenv

load_dotenv()

TOKEN = os.getenv('DISCORD_BOT_TOKEN')
intents = discord.Intents.default()
bot = commands.Bot(command_prefix='!', intents=intents)
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")

openai.api_key = OPENAI_API_KEY

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')

@bot.event
async def on_message(message):
    #check if the message is from a user
    if not message.author.bot and bot.user.mentioned_in(message):

        user_message = message.content.split(' ', 1)[1]

        response = 'Nothing yet!'

        if user_message.startswith('!ask'):
            question = message.content[5:] #remove !ask from last message content 

            response = openai.ChatCompletion.create(
                model="gpt-4",
                messages=[
                    {"role": "system", "content": "you are a helpful assistant."},
                    {"role": "user", "content": question}
                ],
            )
    await message.channel.send(response['choices'][0]['message']['content'])



    await bot.process_commands(message)
def run_chat_gpt_bot():
    bot.run(TOKEN) 

still looking for a solution , im currently using tesseract OCR to at the vary least detect text and pass that to GPT4 so it kinda of works . but i want it to be able to describe a image like how gpt-4 does in the openai gpt4 chat page

Well, besides needing the “intents” specifically for the message contents, you’ll need to wait until there is an OpenAI API product available that has computer vision.

Or use something different:

I as well am wanting to upload an image to ChatGPT4 using the API, as it allows in the web version. Any help on this?

The API does not have an AI model that allows image upload or computer vision.

That may come in the future.

Before even asking how to do it, you’d want to know the price. :slightly_smiling_face:

I don’t care about the prices, I want to be able to do it