当前位置: 首页 > wzjs >正文

郑州哪里可以做网站网站技术外包公司

郑州哪里可以做网站,网站技术外包公司,网站体验方案,辽阳企业网站建设参考链接地址:如何使用Qwen-VL模型_大模型服务平台百炼(Model Studio)-阿里云帮助中心 在windows下,使用python语言测试,版本:Python 3.8.9 一. 使用QVQ模型解决图片数学难题 import os import base64 import requests# base 64 …

参考链接地址:如何使用Qwen-VL模型_大模型服务平台百炼(Model Studio)-阿里云帮助中心

在windows下,使用python语言测试,版本:Python 3.8.9

一. 使用QVQ模型解决图片数学难题

import os
import base64
import requests#  base 64 编码格式
def encode_image(image_path):with open(image_path, "rb") as image_file:return base64.b64encode(image_file.read()).decode("utf-8")# 将xxxx/test.png替换为你本地图像的绝对路径
base64_image = encode_image("D:\\AI\\Ali_AI\\test1.png")
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
#api_key = os.getenv("DASHSCOPE_API_KEY")
#qwen-vl-max-latest
api_key="sk-cb1a12c560fa441eabefdb2938c6cdff"
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
payload = {"model": "qwen-vl-max-latest","messages": [{"role": "system","content": [{"type":"text","text": "You are a helpful assistant."}]},{"role": "user","content": [{"type": "image_url",# 需要注意,传入Base64,图像格式(即image/{format})需要与支持的图片列表中的Content Type保持一致。"f"是字符串格式化的方法。# PNG图像:  f"data:image/png;base64,{base64_image}"# JPEG图像: f"data:image/jpeg;base64,{base64_image}"# WEBP图像: f"data:image/webp;base64,{base64_image}""image_url": {"url": f"data:image/png;base64,{base64_image}"},},{"type": "text", "text": "识别图片中的内容并输出"},],}],
}
response = requests.post("https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",headers=headers,json=payload,
)content1=response.json()["choices"][0]["message"]["content"]
print(content1)
payload = {"model": "qwen2-math-72b-instruct","messages": [{"role": "system","content": "You are a helpful assistant."},{"role": "user", "content": f"{content1},给出正确的答案,不需要过程分析"}],
}
response = requests.post("https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",headers=headers,json=payload,
)
print(response.json()["choices"][0]["message"]["content"]) 

1.先获取图片内容

使用模型:qwen-vl-max-latest

2.对数学难题进行解答

使用模型:qwen2-math-72b-instruct

二. 调用API实现图片内容提取

测试源码如下:

import os
import base64
import requests#  base 64 编码格式
def encode_image(image_path):with open(image_path, "rb") as image_file:return base64.b64encode(image_file.read()).decode("utf-8")# 将xxxx/test.png替换为你本地图像的绝对路径
base64_image = encode_image("D:\\AI\\Ali_AI\\test.jpg")
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
#api_key = os.getenv("DASHSCOPE_API_KEY")
api_key="sk-d9b2178c495e4ea7bd3a11e0fc71984a"
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {api_key}"}
payload = {"model": "qwen-vl-max-latest","messages": [{"role": "system","content": [{"type":"text","text": "You are a helpful assistant."}]},{"role": "user","content": [{"type": "image_url",# 需要注意,传入Base64,图像格式(即image/{format})需要与支持的图片列表中的Content Type保持一致。"f"是字符串格式化的方法。# PNG图像:  f"data:image/png;base64,{base64_image}"# JPEG图像: f"data:image/jpeg;base64,{base64_image}"# WEBP图像: f"data:image/webp;base64,{base64_image}""image_url": {"url": f"data:image/png;base64,{base64_image}"},},{"type": "text", "text": "请扫描图片中的文字并输出?"},],}],
}
response = requests.post("https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",headers=headers,json=payload,
)
print(response.json()["choices"][0]["message"]["content"])

文件放置路径:

运行结果如下:

http://www.dtcms.com/wzjs/172990.html

相关文章:

  • 泰州网站建设济南网络营销外包
  • 北京专业做网站互联网营销外包公司
  • 网站对比专业全网优化
  • 自己做网站吗西安seo培训机构
  • 360推广和百度推广哪个好北京自动seo
  • 望城区网站建设发外链平台
  • 长治做网站多少钱郑州seo外包服务
  • 如何做彩票网站的源码seo好学吗入门怎么学
  • 茶社网站开发与设计的开题报告满十八岁可以申请abc认证吗
  • 建个私人网站怎么做企业网站建设需要多少钱
  • 网站难做seo排名影响因素主要有
  • 网站建设培训中心广告公司起名大全最新
  • 杭州网站的制作seo快速排名案例
  • 旅游网站后台html模板免费网站推广群发软件
  • 顺德公益网站制作惠州seo网站管理
  • 网站后期的维护semester怎么读
  • 怎样做网站公司seo网站首页推广
  • 中小型网站建设服务家庭优化大师下载
  • 石家庄市网站建设培训班广东深圳疫情最新情况
  • 西藏建设厅官方网站网站优化建议
  • 网站 售后服务搜索引擎培训班
  • 做网站的工作时间恢复2345网址导航
  • 做外贸网站的经验百度网址大全在哪里找
  • 正品购物网站排行软文代写平台
  • 有哪些做互联网项目的导航网站找客户的十大方法
  • 盐城网站推广电话产品线上营销推广方案
  • 网站建设收费标准百度竞价推广点击软件奔奔
  • 金山建设机械网站最新域名查询ip
  • 如何查看一个网站是用什么cms做的视频号视频下载助手app
  • 网站 跳出率 多少网站优化外包价格