18 lines
650 B
Python
18 lines
650 B
Python
import os
|
|
from dashscope import MultiModalConversation
|
|
import dashscope
|
|
|
|
# 本地图像的绝对路径
|
|
local_path = r"D:\Python\mcunc\EmojiTextGenerator\emojis\00e4f193-74af-40f7-8722-59d5a5931f92.jpg"
|
|
image_path = f"file://{local_path}"
|
|
messages = [
|
|
{'role':'user',
|
|
'content': [{'image': image_path},
|
|
{'text': '使用简洁语言描述该表情包 ,例如 在吗 ,生气,?'}]}]
|
|
response = MultiModalConversation.call(
|
|
api_key="sk-213f83213fce4e2ba41b8e67721f19cb",
|
|
model='qwen3-vl-plus',
|
|
messages=messages)
|
|
|
|
print(response.output.choices[0].message.content[0]["text"])
|