parent
49e3134025
commit
bc0390159b
Binary file not shown.
@ -0,0 +1,47 @@
|
||||
|
||||
# https://qwenlm.github.io/zh/blog/qwen2.5-vl-32b/
|
||||
from openai import OpenAI
|
||||
from WxMini.Milvus.Config.MulvusConfig import *
|
||||
|
||||
client = OpenAI(
|
||||
api_key=MODELSCOPE_ACCESS_TOKEN,
|
||||
base_url="https://api-inference.modelscope.cn/v1"
|
||||
)
|
||||
# 提示词
|
||||
prompt = "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."
|
||||
|
||||
# 要解决的图片问题
|
||||
#img_url = 'https://qianwen-res.oss-cn-beijing.aliyuncs.com/QVQ/demo.png'
|
||||
# 答案=46
|
||||
|
||||
#img_url='https://hzkc.oss-cn-beijing.aliyuncs.com/Temp/simple_math.jpeg'
|
||||
# 答案应该是80度
|
||||
|
||||
#img_url='https://hzkc.oss-cn-beijing.aliyuncs.com/Temp/child_math.jpeg'
|
||||
img_url='https://hzkc.oss-cn-beijing.aliyuncs.com/Temp/child_math2.jpg'
|
||||
|
||||
response = client.chat.completions.create(
|
||||
#model="Qwen/QVQ-72B-Preview",
|
||||
model="Qwen/Qwen2.5-VL-32B-Instruct",
|
||||
messages=[
|
||||
{
|
||||
"role": "system",
|
||||
"content": [
|
||||
{"type": "text", "text": prompt}
|
||||
],
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {"url": img_url}
|
||||
},
|
||||
{"type": "text", "text": "请使用中文回答:帮我看看计算的对不对?"},
|
||||
],
|
||||
}
|
||||
],
|
||||
stream=True
|
||||
)
|
||||
for chunk in response:
|
||||
print(chunk.choices[0].delta.content, end='', flush=True)
|
Loading…
Reference in new issue