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.
26 lines
980 B
26 lines
980 B
from openai import OpenAI
|
|
from WxMini.Milvus.Config.MulvusConfig import *
|
|
|
|
client = OpenAI(
|
|
api_key=MODEL_API_KEY,
|
|
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
)
|
|
completion = client.chat.completions.create(
|
|
model="qwen-vl-ocr",
|
|
messages=[
|
|
{
|
|
"role": "user",
|
|
"content": [
|
|
{
|
|
"type": "image_url",
|
|
"image_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241108/ctdzex/biaozhun.jpg",
|
|
"min_pixels": 28 * 28 * 4,
|
|
"max_pixels": 28 * 28 * 1280
|
|
},
|
|
# 为保证识别效果,目前模型内部会统一使用"Read all the text in the image."进行识别,用户输入的文本不会生效。
|
|
{"type": "text", "text": "Read all the text in the image."},
|
|
]
|
|
}
|
|
])
|
|
|
|
print(completion.choices[0].message.content) |