当前位置:网站首页>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 边栏推荐
猜你喜欢

从攻击面视角,看信创零信任方案实践

Summary of data export methods in powerbi

III Chip startup and clock system

Pit of the start attribute of enumrate
![[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?](/img/66/674a06d8e45a31ae879b81554ef373.png)
[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?

微信小程序利用百度api达成植物识别

The first white paper on agile practice in Chinese enterprises was released | complete download is attached

QT learning diary 7 - qmainwindow

How to use ide to automatically sign and debug Hongmeng application

QT learning diary 8 - resource file addition
随机推荐
高德根据轨迹画线
enumrate的start属性的坑
【云原生】2.5 Kubernetes 核心实战(下)
map集合赋值到数据库
三.芯片啟動和時鐘系統
Why does LabVIEW lose precision in floating point numbers
[paid promotion] collection of frequently asked questions, recommended list FAQ
Skills of PLC recorder in quickly monitoring multiple PLC bits
程序员成长第六篇:如何选择公司?
[ark UI] implementation of the startup page of harmonios ETS
MTK full dump grab
Calculate the sum of sequences
On April 17, 2022, the five heart matchmaker team received double good news
[AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
原生方法合并word
STM32单片机编程学习
Internship report skywalking distributed link tracking?
接口调试工具概论
C# 文件与文件夹操作