You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
QingLong/AI/WxMini/Test/X1_ReadImage_GaoFenBianLvLi...

25 lines
867 B

4 months ago
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"])