Skip to content

Commit a4c571a

Browse files
fixed semicolons, incremented package.json version to 1.2.2
1 parent 72e78fd commit a4c571a

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
global.fetch = require("node-fetch");
22

3-
const { Readable } = require('stream')
4-
const tf = require('@tensorflow/tfjs')
5-
const PImage = require('pureimage')
6-
const isImageUrl = require('is-image-url')
7-
const parseDataUrl = require('parse-data-url')
3+
const { Readable } = require('stream');
4+
const tf = require('@tensorflow/tfjs');
5+
const PImage = require('pureimage');
6+
const isImageUrl = require('is-image-url');
7+
const parseDataUrl = require('parse-data-url');
88

99
const wait = ms => new Promise(r => setTimeout(r, ms));
1010

@@ -28,7 +28,7 @@ const retryOperation = (operation, delay, times) => new Promise((resolve, reject
2828
const bufferToStream = (binary) => {
2929
const readableInstanceStream = new Readable({
3030
read() {
31-
this.push(binary)
31+
this.push(binary);
3232
this.push(null);
3333
}
3434
});
@@ -77,7 +77,7 @@ const getTopKClasses = async (logits, classes) => {
7777
topkIndices[i] = valuesAndIndices[i].index;
7878
}
7979

80-
const topClassesAndProbs = []
80+
const topClassesAndProbs = [];
8181
for (let i = 0; i < topkIndices.length; i++) {
8282
topClassesAndProbs.push({
8383
class: classes[topkIndices[i]],
@@ -101,7 +101,7 @@ class SashiDoTeachableMachine {
101101

102102
try {
103103
const modelURL = `${modelUrl}model.json`;
104-
const response = await fetch(`${modelUrl}metadata.json`)
104+
const response = await fetch(`${modelUrl}metadata.json`);
105105
const body = await response.text();
106106
this.model = await tf.loadLayersModel(modelURL);
107107
this.model.classes = JSON.parse(body).labels;
@@ -139,15 +139,15 @@ class SashiDoTeachableMachine {
139139

140140
async inference({ imageUrl }) {
141141
try {
142-
let data
143-
let buffer
144-
let contentType
142+
let data;
143+
let buffer;
144+
let contentType;
145145

146146
if (imageUrl.startsWith('data:image/')) {
147-
data = parseDataUrl(imageUrl)
147+
data = parseDataUrl(imageUrl);
148148

149-
contentType = data.contentType
150-
buffer = data.toBuffer()
149+
contentType = data.contentType;
150+
buffer = data.toBuffer();
151151
} else {
152152
data = await fetch(imageUrl);
153153

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sashido/teachablemachine-node",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "Simplifies integration with Teachable Machine models from Google",
55
"author": {
66
"name": "Team SashiDo",

0 commit comments

Comments
 (0)