// index.ts
var server_url = 'https://www.cscv.tech/inference'
Page({
data: {
index_img_path: '../../images/cat.jpg',
face_img: '../../images/face.png',
mask_img: '../../images/mask.png',
total: null,
result: null,
},
// 用户间分享
onShareAppMessage: function() {
return {
title: 'Yolov5使用体验',
path: '/pages/index/index'
}
},
// 分享到朋友圈
onShareTimeline: function() {
return {
title: 'Yolov5使用体验',
imageUrl: '/images/火箭.png'
}
},
// 事件处理函数
doIdentify: function() {
var that = this
// 选择图片
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: res => {
// tempFilePath为本地临时文件地址
var tempFilePath = res.tempFiles[0].tempFilePath
if(res.tempFiles[0].size > (4 * 1024 * 1024)) {
wx.showToast({
title: '图片文件过大哦',
icon: 'none',
mask: true
})
}else {
that.setData({index_img_path: tempFilePath})
var base64 = 'data:image/png;base64,'+wx.getFileSystemManager()
.readFileSync(tempFilePath, "base64");
wx.showLoading({
title: '检测中...',
})
wx.request({
url: server_url,
data: JSON.stringify(base64),
method: "POST",
// 请求成功!
success: res => {
console.log(res)
wx.hideLoading()
that.setData({
index_img_path: res.data.image,
result: res.data.objects,
total: res.data.total
})
},
// 请求失败
fail: (err) => {
console.log(err)
wx.hideLoading()
wx.showToast({
title: '检测失败',
icon: 'none',
mask: true
})
}
})
}
}
})
},
})
没有合适的资源?快使用搜索试试~ 我知道了~
yolov5/v6.0微信小程序前端代码
共55个文件
wxss:12个
json:12个
png:11个
需积分: 0 35 下载量 23 浏览量
2023-05-23
19:14:27
上传
评论 1
收藏 833KB ZIP 举报
温馨提示
yolov5使用微信小程序部署,需要在腾讯云或阿里云等租一个服务器,配置域名和相关证书、端口等。
资源推荐
资源详情
资源评论
收起资源包目录
yolov5.zip (55个子文件)
yolov5
sitemap.json 191B
pages
index
index.wxml 2KB
index.js 2KB
index.json 40B
index.wxss 2KB
play
picSmart
picSmart.wxml 181B
picSmart.js 854B
picSmart.json 27B
picSmart.wxss 39B
play.wxml 814B
play.wxss 26B
play.json 68B
picGen
picGen.wxss 35B
picGen.js 850B
picGen.wxml 181B
picGen.json 27B
play.js 924B
mine
about
about.wxss 34B
about.js 938B
about.json 40B
about.wxml 676B
mine.js 598B
mine.json 41B
mine.wxss 925KB
mine.wxml 2KB
myRecord
myRecord.js 944B
myRecord.wxml 211B
myRecord.wxss 39B
myRecord.json 27B
myAchievement
myAchievement.wxss 49B
myAchievement.json 27B
myAchievement.js 954B
myAchievement.wxml 211B
app.json 1KB
project.config.json 2KB
app.js 768B
utils
app.wxss 253B
colorui
components
cu-custom
cu-custom.json 48B
cu-custom.js 831B
cu-custom.wxml 972B
cu-custom.wxss 39B
main.wxss 65KB
icon.wxss 70KB
images
cv-smart.png 11KB
火箭.png 6KB
face.png 7KB
mask.png 8KB
tabBar
home.png 527B
about.png 766B
about-on.png 796B
game-on.png 1KB
game.png 1KB
home-on.png 556B
cat.jpg 13KB
cv-product.png 9KB
共 55 条
- 1
资源评论
不会数分的程序员不是好会计
- 粉丝: 174
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功