当前位置:网站首页>微信小程序利用百度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前端成长日记边栏推荐
- TIPC介绍1
- liftOver进行基因组坐标转换
- Iii. Système de démarrage et d'horloge à puce
- 通过券商经理的开户二维码开股票账户安全吗?还是去证券公司开户安全?
- ASTParser 解析含有emum 枚举方法的类文件的踩坑记
- Flink two Open, implement Batch Lookup join (attached source)
- How to transfer event objects and user-defined parameters simultaneously in Huawei express applications
- Eight sorting summaries
- What are the software product management systems? Inventory of 12 best product management tools
- Why does LabVIEW lose precision in floating point numbers
猜你喜欢

【深入浅出玩转FPGA学习5-----复位设计】

Use Huawei performance management service to configure the sampling rate on demand

How does the whole network display IP ownership?

ImportError: cannot import name ‘Digraph‘ from ‘graphviz‘

一.STM32的开发环境,keil5/MDK5.14安装教程(附下载链接)

ctf 记录

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

QT learning diary 7 - qmainwindow

Summary of data export methods in powerbi

Internship report skywalking distributed link tracking?
随机推荐
MTK full dump抓取
Tick Data and Resampling
flink二開,實現了個 batch lookup join(附源碼)
Skills of PLC recorder in quickly monitoring multiple PLC bits
Verilog and VHDL signed and unsigned number correlation operations
sql left join 主表限制条件写在on后面和写在where后面的区别
LVM operation
Binary tree topic -- Luogu p3884 [jloi2009] binary tree problem (DFS for binary tree depth BFS for binary tree width Dijkstra for shortest path)
ROS lacks catkin_ pkg
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
Multi line display and single line display of tqdm
[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
八大排序汇总
Xiao Sha's pain (double pointer
flink二开,实现了个 batch lookup join(附源码)
Basic usage of MySQL in centos8
[paid promotion] collection of frequently asked questions, recommended list FAQ
Appgallery connect scenario development practice - image storage and sharing
TIPC Cluster5
Functional interfaces and method references