Files
QingLong/AI/WxMini/Test/X1_ReadImage_GaoFenBianLvLiJie.py
2025-08-15 09:13:13 +08:00

25 lines
867 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import dashscope
from WxMini.Milvus.Config.MulvusConfig import *
messages = [
{
"role": "user",
"content": [
{"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250212/earbrt/vcg_VCG211286867973_RF.jpg"},
{"text": "这张图表现了什么内容?"}
]
}
]
response = dashscope.MultiModalConversation.call(
# 若没有配置环境变量请用百炼API Key将下行替换为api_key="sk-xxx"
api_key=MODEL_API_KEY,
model='qwen-vl-max-latest',
messages=messages,
vl_high_resolution_images=True
)
print("大模型的回复:\n ",response.output.choices[0].message.content[0]["text"])
print("Token用量情况","输入总Token",response.usage["input_tokens"] , "输入图像Token" , response.usage["image_tokens"])