updated docs

pull/13/head
Vladimir Mandic 2020-10-11 12:50:50 -04:00
parent 253601e061
commit 205de4831a
2 changed files with 49 additions and 48 deletions

View File

@ -34,13 +34,16 @@ Due to reduced code and changed build process, resulting bundle is about **>5x s
There are several ways to use Face-API: There are several ways to use Face-API:
### IIFE script **Important**: This version of Face-Api does NOT pre-package `TFJS` to allow for faster downloads (it's much smaller) as well as to allow user to choose version of TFJS to use (it's compatible with any `TFJS 2.0+`).
### 1. IIFE script
*Size: 936KB minified* *Size: 936KB minified*
This is simplest way for usage within Browser as it includes full version of TensorFlow/JS prepackaged with no external dependencies. This is simplest way for usage within Browser
Simply download `dist/face-api.js`, include it in your `HTML` file & it's ready to use. Simply download `dist/face-api.js`, include it in your `HTML` file & it's ready to use.
```html ```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js"></script>
<script src="dist/face-api.js"><script> <script src="dist/face-api.js"><script>
``` ```
@ -53,9 +56,7 @@ There are several ways to use Face-API:
IIFE script auto-registers global namespace `faceapi` within Window object. IIFE script auto-registers global namespace `faceapi` within Window object.
And if you want to access `TensorFlow/JS` classes directly, they are exported as `faceapi.tf` And if you want to access `TensorFlow/JS` classes directly, they are exported as `faceapi.tf`
Pre-packaged version of `TFJS` is **2.6.0** ### 2. ESM module
### ESM module
*Size: 164KB non-minified* *Size: 164KB non-minified*
If you're using bundler *(such as rollup, webpack, esbuild)* to package your client application, you can import ESM version of FaceAPI which supports full tree shaking If you're using bundler *(such as rollup, webpack, esbuild)* to package your client application, you can import ESM version of FaceAPI which supports full tree shaking
@ -80,7 +81,7 @@ There are several ways to use Face-API:
import * as faceapi from 'dist/face-api.esm.js'; import * as faceapi from 'dist/face-api.esm.js';
``` ```
### NPM module ### 3. NPM module
*Size: 45,104KB unpacked (including sources and pre-trained model weights)* *Size: 45,104KB unpacked (including sources and pre-trained model weights)*
Simmilar to ESM module, but with full sources as it points to `build/src/index.js` instead Simmilar to ESM module, but with full sources as it points to `build/src/index.js` instead

View File

@ -5,7 +5,7 @@
<meta http-equiv="content-type"> <meta http-equiv="content-type">
<meta content="text/html"> <meta content="text/html">
<meta charset="UTF-8"> <meta charset="UTF-8">
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js"></script> --> <script src="https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js"></script>
<script src="https://vladmandic.github.io/face-api/dist/face-api.js"></script> <script src="https://vladmandic.github.io/face-api/dist/face-api.js"></script>
<style> <style>
body { font-family: monospace; background: black; color: white; font-size: 16px; line-height: 22px; margin: 0; } body { font-family: monospace; background: black; color: white; font-size: 16px; line-height: 22px; margin: 0; }