The Anura Web Core SDK is designed for JavaScript client-application developers. It offers simple, flexible way to take web-based measurements.
The main way that we ship our Anura Web Core SDK code to NPM is as ECMAScript modules with ECMAScript 2022, the 13th edition syntax. This allows developers to take advantage of modern JavaScript features and have greater control over what they ship to their end users.
You can use either of the following methods to add the library to your project:
# yarn
yarn add @nuralogix.ai/anura-web-core-sdk
# npm
npm install @nuralogix.ai/anura-web-core-sdk
You can use Anura Web Core SDK
directly in the browser via a CDN such as
unpkg, jsDelivr,
Skypack, esm.sh and
npmmirror (a complete mirror of npmjs.com in China).
Here are some key advantages of using import maps to load
Anura Web Core SDK
from well-known CDNs:
1. Simplifies Dependency Management
2. Faster Load Times with CDNs
3. Automatic Versioning and Updates
unpkg.com/:package@:version/:file
).4. Reduces Build Complexity
npm install
or package-lock files for browser-only apps.5. Optimized for Browser Environments
6. Flexible Module Resolution
7. Ideal for Prototyping and Demos
You can use importmap to reference the SDK:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anura Web Core SDK</title>
<script type="importmap">
{
"imports": {
"@nuralogix.ai/anura-web-core-sdk": "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk",
"@nuralogix.ai/anura-web-core-sdk/helpers": "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/helpers/index.min.mjs",
"@nuralogix.ai/anura-web-core-sdk/masks/anura": "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/masks/anura/index.mjs",
"@nuralogix.ai/anura-web-core-sdk/masks/tele": "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/masks/tele/index.mjs"
}
}
</script>
<style>
.measurement-container {width: 360px; height: 640px;}
</style>
</head>
<body>
<div class="measurement-container">
<div id="measurement"></div>
</div>
<script type="module">
import { Measurement, faceAttributeValue, faceTrackerState } from '@nuralogix.ai/anura-web-core-sdk';
import helpers from "@nuralogix.ai/anura-web-core-sdk/helpers";
import { AnuraMask } from "@nuralogix.ai/anura-web-core-sdk/masks/anura";
const { CameraController } = helpers;
const camera = CameraController.init();
const mediaElement = document.getElementById('measurement');
if (mediaElement && mediaElement instanceof HTMLDivElement) {
const settings = {
mediaElement,
assetFolder: 'https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/assets',
apiUrl: 'api.deepaffex.ai',
mirrorVideo: true,
displayMediaStream: true,
metrics: false
};
const measurement = await Measurement.init(settings);
const mask = new AnuraMask();
}
</script>
</body>
</html>
Alternatively, you can import the module directly from a CDN without using import maps:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anura Web Core SDK</title>
<style>
.measurement-container {width: 360px; height: 640px;}
</style>
</head>
<body>
<div class="measurement-container">
<div id="measurement"></div>
</div>
<script type="module">
import { Measurement, faceAttributeValue, faceTrackerState } from 'https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/index.min.mjs';
import helpers from "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/helpers/index.min.mjs";
import { AnuraMask } from "https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/masks/anura/index.mjs";
const { CameraController } = helpers;
const camera = CameraController.init();
const mediaElement = document.getElementById('measurement');
if (mediaElement && mediaElement instanceof HTMLDivElement) {
const settings = {
mediaElement,
assetFolder: 'https://unpkg.com/@nuralogix.ai/anura-web-core-sdk/lib/assets',
apiUrl: 'api.deepaffex.ai',
mirrorVideo: true,
displayMediaStream: true,
metrics: false
};
const measurement = await Measurement.init(settings);
const mask = new AnuraMask();
}
</script>
</body>
</html>