From 205de4831ac76ed5b1efa9bb5b48ae371c5c5138 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 11 Oct 2020 12:50:50 -0400 Subject: [PATCH] updated docs --- README.md | 95 +++++++++++++++++++++++----------------------- example/index.html | 2 +- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index eceaec2..c2d4492 100644 --- a/README.md +++ b/README.md @@ -34,67 +34,68 @@ Due to reduced code and changed build process, resulting bundle is about **>5x s There are several ways to use Face-API: -### IIFE script - *Size: 936KB minified* +**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+`). - This is simplest way for usage within Browser as it includes full version of TensorFlow/JS prepackaged with no external dependencies. - Simply download `dist/face-api.js`, include it in your `HTML` file & it's ready to use. +### 1. IIFE script +*Size: 936KB minified* - ```html - + - ``` +For a quick test, you can access the script directly from `gitpages` - 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` +```html + +``` - Pre-packaged version of `TFJS` is **2.6.0** +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` -### ESM module - *Size: 164KB non-minified* +### 2. ESM module +*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 - Note that this version does NOT pre-package `TFJS`, so you'll need to include it before you import `FaceAPI` - You can use any version of `TFJS` 2.0+ +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 +Note that this version does NOT pre-package `TFJS`, so you'll need to include it before you import `FaceAPI` +You can use any version of `TFJS` 2.0+ - ```js - import * as tf from 'https://cdnjs.cloudflare.com/ajax/libs/tensorflow/2.6.0/tf.min.js'; // load directly from CDN - import * as faceapi from 'dist/face-api.esm.js'; - ``` - *Experimental*: - You could use same syntax within your main `JS` file if it's imported with `