25 lines
867 B
Python
25 lines
867 B
Python
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"])
|