当前位置:网站首页>微信小程序利用百度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
前端成长日记
边栏推荐
- Internship report skywalking distributed link tracking?
- Win11 arm system configuration Net core environment variable
- TIPC Cluster5
- PKG package manager usage instance in FreeBSD
- 数字化转型挂帅复产复工,线上线下全融合重建商业逻辑
- Solve the problem of data blank in the quick sliding page of the uniapp list
- 在网上开股票账户安全吗?我是新手,还请指导
- Jenkins installation
- Verilog 和VHDL有符号数和无符号数相关运算
- 【云原生】2.5 Kubernetes 核心实战(下)
猜你喜欢
[applinking practical case] share in app pictures through applinking
Tick Data and Resampling
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
【深入浅出玩转FPGA学习3-----基本语法】
Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
Creation and use of unified links in Huawei applinking
mmrotate旋转目标检测框架使用记录
TIPC messaging3
Verilog and VHDL signed and unsigned number correlation operations
Matlab processing of distance measurement of experimental electron microscope
随机推荐
Is bond fund safe? Does the bond buying foundation lose principal?
MTK full dump抓取
三.芯片启动和时钟系统
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
Special topic of binary tree -- acwing 18 Rebuild the binary tree (construct the binary tree by traversing the front and middle order)
Array splitting (regular thinking
How to transfer event objects and user-defined parameters simultaneously in Huawei express applications
Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)
I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)
STM32 single chip microcomputer programming learning
Rest (XOR) position and thinking
Some suggestions for young people who are about to enter the workplace in the graduation season
Tick Data and Resampling
Special topic of binary tree -- acwing 1589 Building binary search tree
Summary of cases of players' disconnection and reconnection in Huawei online battle service
JVM garbage collector
Indexer in C #
ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘
[paid promotion] collection of frequently asked questions, recommended list FAQ
Order by注入