当前位置:网站首页>Wechat applet uses Baidu API to achieve plant recognition
Wechat applet uses Baidu API to achieve plant recognition
2022-07-02 11:26:00 【InfoQ】
After reading this article, you can learn :
- How to use Baidu AI Cloud
- How to access Baidu in wechat applet api, Achieve the effect of plant recognition
How to use Baidu AI Cloud ?


- API Key
- Secret Key

according to API Key And Secret Key obtain token


// obtain 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)
}
})
},
utilize api Perform plant identification

// Get recognition results
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);
},
})
},
At the end
Ned Front end growth diary 边栏推荐
猜你喜欢

三.芯片启动和时钟系统

Implement custom drawer component in quick application

TIPC messaging3

Pit of the start attribute of enumrate

2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises

Is the Ren domain name valuable? Is it worth investing? What is the application scope of Ren domain name?

CTF record

TIPC 寻址2

How to implement tabbar title bar with list component

TIPC Cluster5
随机推荐
Resources reads 2D texture and converts it to PNG format
The difference between self and static in PHP in methods
sql left join 主表限制条件写在on后面和写在where后面的区别
spritejs
mysql链表数据存储查询排序问题
启牛商学院给的股票账户安全吗?能开户吗?
The difference between SQL left join main table restrictions written after on and where
String (Analog
Why does LabVIEW lose precision in floating point numbers
Webauthn - official development document
enumrate的start属性的坑
Jenkins安装
Resources读取2d纹理 转换为png格式
map集合赋值到数据库
III Chip startup and clock system
PKG package manager usage instance in FreeBSD
Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic
Redis超出最大内存错误OOM command not allowed when used memory > 'maxmemory'
Gaode draws lines according to the track
One trick to quickly realize custom application titlebar