LyonGao / fetch-wechat

Fetch poly-fill for WeChat mini program platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fetch-wechat

Fetch polyfill for WeChat mini program platform to work with TensorFlow.js.

TensorFlow.js allow you to load models served by HTTPs server. There are two model loading APIs

  • tf.loadGraphModel
  • tf.loadLayerModel

Both of which requires a fetch API exposed on the global scope or provided as part of the loadOption field.

The library is essentially a wrapper of wx.request API that simulates the fetch API. This is inspired by wxapp-fetch, with simpler code base and support of arraybuffer function.

Code example:

import { fetchFunc } from 'wechat_fetch';

const model = await tf.loadGraphModel(
      'https://model.url.com/model.json', {fetchFunc: fetchFunc()});

About

Fetch poly-fill for WeChat mini program platform

License:MIT License


Languages

Language:JavaScript 58.4%Language:TypeScript 37.2%Language:Shell 4.4%