如何上传图像作为上下文并提示 GPT4 的 api?

Bla*_*ung 7 openai-api chatgpt-api gpt-4 chat-gpt-4

我看到这里有多种图像生成方法: https://platform.openai.com/docs/api-reference/images

但我只是想向聊天 gpt 发送一个 png 文件,问“这是什么?” 或类似的事情,然后得到回复。

All*_*n M 1

有可能的...

\n

但根据论坛中的回复,现在在 chatGPT 中还没有:

\n
\n

你想要的是 \xe2\x80\x9cimage captioning\xe2\x80\x9d ,而不是 OpenAI 目前在其 API 中提供的服务。

\n

您可以检查其他 API(例如 Azure 描述图像 API)或服务(例如 hive.ai),或托管您自己的 CLIP 模型。

\n
\n

来源:https://community.openai.com/t/how-can-i-get-description-from-the-content-of-the-image/307090/2

\n

使用 Azure 计算机视觉来描述图像

\n

但我确实发现可以使用Azure AI 服务来描述图像 | 计算机视觉API。

\n
    \n
  1. 创建免费的 Azure 帐户:https://azure.microsoft.com/en-us/free
  2. \n
  3. 转至 Portal.azure.com,通过搜索并单击“计算机视觉”并单击“ + 创建”按钮来创建自己的计算机视觉实例
  4. \n
  5. 输入所需的详细信息(子帐户、姓名等)直至完成
  6. \n
  7. 单击管理密钥:单击此处管理您的密钥和端点的密钥
  8. \n
  9. 保存您的 Key 1 和 Endpoint 值
  10. \n
\n

现在你可以像这样发出curl请求:

\n
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/Broadway_and_Times_Square_by_night.jpg/450px-Broadway_and_Times_Square_by_night.jpg"\n\nimage_analysis = client.analyze_image(\n    url, visual_features=[VisualFeatureTypes.tags])\n
Run Code Online (Sandbox Code Playgroud)\n

完整的代码示例在此 replit 中:https://replit.com/@allenmcgehee/HonoredCarefulBackticks#main.py

\n