当前位置:网站首页>微信小程序利用百度api达成植物识别
微信小程序利用百度api达成植物识别
2022-07-02 09:37:00 【InfoQ】
看完本文你可学会:
- 如何使用百度智能云
- 如何在微信小程序中去接入百度api,达成植物识别的效果
如何使用百度智能云?


- API Key
- Secret Key

根据API Key与Secret Key获取token


// 获取token
getToken(){
wx.request({
url: `https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=${this.data.apiKey}&client_secret=${this.data.secretKey}`,
success:(res)=>{
const token = res.data.access_token
this.getResult(token)
}
})
},
利用api进行植物识别

//获取识别结果
getResult(token){
wx.request({
url: 'https://aip.baidubce.com/rest/2.0/image-classify/v1/plant?access_token=' + token,
method:'POST',
data:{
image:this.data.base64Img
},
header:{
'Content-Type':'application/x-www-form-urlencoded'
},
success:(res)=>{
console.log(res);
},
})
},
写在最后
Ned
前端成长日记
边栏推荐
- 解决uniapp列表快速滑动页面数据空白问题
- 接口调试工具概论
- Uncover the secrets of Huawei application market application statistics
- Jenkins安装
- 每月1号开始计算当月工作日
- II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation
- 【云原生】2.5 Kubernetes 核心实战(下)
- Implement custom drawer component in quick application
- liftOver进行基因组坐标转换
- LVM操作
猜你喜欢
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Special topic of binary tree -- acwing 47 Path with a certain value in binary tree (preorder traversal)
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
flink二开,实现了个 batch lookup join(附源码)
CentOS8之mysql基本用法
TIPC Service and Topology Tracking4
flink二開,實現了個 batch lookup join(附源碼)
Uncover the secrets of Huawei application market application statistics
webauthn——官方开发文档
从攻击面视角,看信创零信任方案实践
随机推荐
Xiao Sha's pain (double pointer
Internship report skywalking distributed link tracking?
Logu p3398 hamster looks for sugar (double LCA on the tree to judge whether the two paths in the tree intersect)
LVM操作
V2x SIM dataset (Shanghai Jiaotong University & New York University)
[AI application] Hikvision ivms-4200 software installation
对毕业季即将踏入职场的年轻人的一点建议
原生方法合并word
TIPC Getting Started6
js中给数组添加元素的方法有哪些
Verilog 和VHDL有符号数和无符号数相关运算
启牛商学院给的股票账户安全吗?能开户吗?
Resources读取2d纹理 转换为png格式
[quick application] win7 system cannot run and debug projects using Huawei ide
TIPC messaging3
Tick Data and Resampling
TIPC Service and Topology Tracking4
mysql 基本语句
[ark UI] implementation of the startup page of harmonios ETS
Jinshanyun - 2023 Summer Internship