当前位置:网站首页>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 边栏推荐
- LVM operation
- TIPC介绍1
- Implement custom drawer component in quick application
- 2022年4月17日五心红娘团队收获双份喜报
- Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
- ros gazebo相关包的安装
- Regular and common formulas
- How to implement tabbar title bar with list component
- STM32单片机编程学习
- mysql 基本语句
猜你喜欢

Huawei game failed to initialize init with error code 907135000

PHP tea sales and shopping online store

Pit of the start attribute of enumrate

PKG package manager usage instance in FreeBSD

TIPC messaging3

QT learning diary 7 - qmainwindow

VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题

I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)

由粒子加速器产生的反中子形成的白洞

ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
随机推荐
The difference between SQL left join main table restrictions written after on and where
Some things configured from ros1 to ros2
TIPC Getting Started6
高德根据轨迹画线
The first white paper on agile practice in Chinese enterprises was released | complete download is attached
TIPC Cluster5
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
Jinshanyun - 2023 Summer Internship
Implement custom drawer component in quick application
Tick Data and Resampling
Resources读取2d纹理 转换为png格式
Summary of cases of players' disconnection and reconnection in Huawei online battle service
Xiao Sha's pain (double pointer
TDSQL|就业难?腾讯云数据库微认证来帮你
Internship report skywalking distributed link tracking?
STM32 single chip microcomputer programming learning
[paid promotion] collection of frequently asked questions, recommended list FAQ
Order by注入
Is bond fund safe? Does the bond buying foundation lose principal?
Verilog and VHDL signed and unsigned number correlation operations