你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

快速入门:开始在 Azure AI Studio 中对图像和视频使用 GPT-4 Turbo with Vision

重要

本文介绍的某些功能可能仅在预览版中提供。 此预览版未提供服务级别协议,不建议将其用于生产工作负载。 某些功能可能不受支持或者受限。 有关详细信息,请参阅 Microsoft Azure 预览版补充使用条款

按照本文的要求,开始通过 Azure AI Studio 来部署和测试 GPT-4 Turbo with Vision 模型。

GPT-4 Turbo with Vision 和 Azure AI 视觉提供的高级功能包括:

  • 光学字符识别 (OCR):从图像中提取文本,将其与用户的提示和图像相结合以扩展上下文。
  • 对象接地:通过对象接地补充 GPT-4 Turbo with Vision 文本响应,并勾勒出输入图像中的突出对象。
  • 视频提示:GPT-4 Turbo with Vision 可以通过检索与用户提示最相关的视频帧来回答问题。

使用 GPT-4 Turbo with Vision 和 Azure AI 视觉功能时,可能需要支付额外的使用费。

先决条件

  • Azure 订阅 - 免费创建订阅
  • 已在所需的 Azure 订阅中授予对 Azure OpenAI 的访问权限。 目前,仅应用程序授予对此服务的访问权限。 可以通过在 https://aka.ms/oai/access 上填写表单来申请对 Azure OpenAI 的访问权限。 如果有任何问题,请在此存储库上提出问题以联系我们。
  • 拥有 Azure 订阅后,请创建 Azure OpenAI 资源
  • AI Studio 中心,其中添加了 Azure OpenAI 资源作为连接。

准备媒体

需要一个图像来完成图像快速入门。 可以使用以下图像或任何其他可用的图像。

可用于完成快速入门的车祸照片。

对于视频提示,需要一个长度短于 3 分钟的视频。

部署 GPT-4 Turbo with Vision 模型

  1. 登录到 Azure AI Studio,然后选择要使用的中心。
  2. 在左侧导航菜单中,选择“ AI 服务”。 选择“试用 GPT-4 Turbo”面板
  3. 在 gpt-4 页上,选择“部署”。 在出现的窗口中,选择 Azure OpenAI 资源。 选择 vision-preview 作为模型版本。
  4. 选择“部署”。
  5. 接下来,前往新模型的页面,然后选择“在操场中打开”。 在聊天操场中,应在“部署”下拉列表中选择创建的 GPT-4 部署。

在此聊天会话中,你指示助手来帮助理解你输入的图像。

  1. 在“系统消息”选项卡上的“系统消息”文本框中,提供此提示来指导助手:"You're an AI assistant that helps people find information."。可以根据图像或方案定制提示。
  2. 选择“应用更改”以保存更改。
  3. 在聊天会话窗格中,选择附件按钮,然后“上传图像”。 选择图像。
  4. 在聊天字段中添加以下问题:"Describe this image",然后选择右箭头图标进行发送。
  5. 右箭头图标将替换为停止按钮。 如果选择该按钮,助手会停止处理你的请求。 对于本快速入门,请让助手完成其回复。
  6. 助手会使用图像的描述进行回复。
  7. 提出与图像分析相关的后续问题。 你可以输入 "What should I highlight about this image to my insurance company?"
  8. 你应会收到类似于此处所示内容的相关响应:
    When reporting the incident to your insurance company, you should highlight the following key points from the image:  
    
    1. **Location of Damage**: Clearly state that the front end of the car, particularly the driver's side, is damaged. Mention the crumpled hood, broken front bumper, and the damaged left headlight.  
    
    2. **Point of Impact**: Indicate that the car has collided with a guardrail, which may suggest that no other vehicles were involved in the accident.  
    
    3. **Condition of the Car**: Note that the damage seems to be concentrated on the front end, and there is no visible damage to the windshield or rear of the car from this perspective.  
    
    4. **License Plate Visibility**: Mention that the license plate is intact and can be used for identification purposes.  
    
    5. **Environment**: Report that the accident occurred near a roadside with a guardrail, possibly in a rural or semi-rural area, which might help in establishing the accident location and context.  
    
    6. **Other Observations**: If there were any other circumstances or details not visible in the image that may have contributed to the accident, such as weather conditions, road conditions, or any other relevant information, be sure to include those as well.  
    
    Remember to be factual and descriptive, avoiding speculation about the cause of the accident, as the insurance company will conduct its own investigation.
    

查看和导出代码

在聊天会话中的任何时间点,你都可以启用聊天窗口顶部的“显示原始 JSON”开关来查看 JSON 格式的对话。 快速入门聊天会话开始时如下所示:

[
	{
		"role": "system",
		"content": [
			"You are an AI assistant that helps people find information."
		]
	},
]

清理资源

为了避免产生不必要的 Azure 成本,如果不再需要在本快速入门中创建的资源,应该将其删除。 若要管理资源,可以使用 Azure 门户

后续步骤