请问微信小程序调用图库的代码怎么写

我想做一个微信小程序用以后续对接深度学习的垃圾图像识别,但是不知道怎么编写调用图库的代码

// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    
name:'垃圾分类,一查便知',
src:'/images/ljfl.jpg',/**定义图片和正文 */

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
},})
<veiw class='container'>
<image src='{{src}}' class='abc'></image>
<text>{{name}}</text>
<button>让我看看你是什么垃圾</button>
</veiw>



/* 样式设计 */
.container{
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;  
  }
  .abc{
   width: 700rpx;
   border-radius: 10%;
  }
  text{
    font-size: 75rpx;
    color:red;
  }
  button{
    color:blue;
    font-size: 50rpx;
  }

我想最后能选择图库或者选择相机的照片,替换原先的src图片文件。

https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html

wx.chooseImage({
  count: 1,
  sizeType: ['original', 'compressed'],
  sourceType: ['album', 'camera'],
  success (res) {
    // tempFilePath可以作为img标签的src属性显示图片
    const tempFilePaths = res.tempFilePaths
  }
})