09.05.2023 Views

pdfcoffee

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13

Audio

Text

General

Utilities

Speech

Commands

(https://

github.com/

tensorflow/

tfjs-models/

tree/master/

speechcommands)

Universal

Sentence

Encoder

(https://

github.com/

tensorflow/

tfjs-models/

tree/master/

universalsentenceencoder)

Text Toxicity

KNN Classifier

(https://

github.com/

tensorflow/

tfjs-models/

tree/

master/knnclassifier)

Classify 1 second audio snippets

from the speech commands

dataset (https://github.

com/tensorflow/docs/

blob/master/site/en/r1/

tutorials/sequences/

audio_recognition.md).

Encode text into a

512-dimensional embedding

to be used as inputs to natural

language processing tasks such

as sentiment classification and

textual similarity.

Score the perceived impact

a comment might have on a

conversation, from "Very toxic" to

"Very healthy".

This package provides a utility

for creating a classifier using the

K-nearest neighbors algorithm; it

can be used for transfer learning.

npm i @

tensorflowmodels/speechcommands

npm i @

tensorflowmodels/

universalsentence-encoder

npm i @

tensorflowmodels/toxicity

npm i @

tensorflowmodels/knnclassifier

Each pretrained model can be directly used from HTML. For instance, this is an

example with the KNN Classifier:

<html>

<head>

<!-- Load TensorFlow.js -->

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs">

</script>

<!-- Load MobileNet -->

<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/

mobilenet"></script>

<!-- Load KNN Classifier -->

<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/knn-

[ 487 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!