Skip to content

Commit a01058b

Browse files
author
Kevin Scott
committed
Update rollup config and readme information
1 parent 2fde2d7 commit a01058b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
ML Classifier is a machine learning engine for quickly training image classification models in your browser. Models can be saved with a single command, and the resulting models reused to make image classification predictions.
44

5+
This package is intended as a companion for [`ml-classifier-ui`](https://github.com/thekevinscott/ml-classifier-ui), which provides a web frontend in React for uploading data and seeing results.
6+
57
## Getting Started
68

79
### Installation
@@ -171,6 +173,8 @@ mlClassifier.save(('path-to-save');
171173
#### Parameters
172174

173175
* **handlerOrUrl** (`io.IOHandler | string`) *Optional* - an argument to be passed to `model.save`. If omitted, the model's unique labels will be concatenated together in the form of `class1-class2-class3`.
176+
* **params** (`Object`) *Optional* - a set of parameters that will be passed directly to `model.save`. [View the Tensorflow.JS docs](https://js.tensorflow.org/api/0.12.0/#tf.Model.save) for an up-to-date list of arguments.
177+
174178

175179
## `getModel`
176180

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ml-classifier",
3-
"version": "0.3.1",
3+
"version": "0.3.3",
44
"description": "A machine learning engine for quickly training image classification models in your browser",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -9,7 +9,6 @@
99
"clean": "rimraf dist/*",
1010
"watch": "npm run build -- --watch",
1111
"build": "npm run clean && rollup -c",
12-
"publish": "npm run build && npm publish",
1312
"test": "jest"
1413
},
1514
"keywords": [

rollup.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import typescript from 'rollup-plugin-typescript2';
33

44
export default {
5-
entry: './src/index.ts',
5+
input: './src/index.ts',
66
output: {
77
name: 'MLClassifier',
88
file: './dist/index.js',
9-
format: 'umd',
9+
format: 'es',
10+
external: [
11+
'@tensorflow/tfjs',
12+
],
1013
},
1114
plugins: [
1215
typescript({

src/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class MLClassifier {
3030
private data: IData = {
3131
classes: {},
3232
};
33-
public tf = tf;
3433

3534
constructor() {
3635
this.init();
@@ -170,13 +169,13 @@ class MLClassifier {
170169
}
171170

172171
// handlerOrURL?: tf.io.IOHandler | string;
173-
public save = async(handlerOrURL?: string) => {
172+
public save = async(handlerOrURL?: string, params: IParams = {}) => {
174173
await this.loaded();
175174
if (!this.model) {
176175
throw new Error('You must call train prior to calling save');
177176
}
178177

179-
return await this.model.save(handlerOrURL || getDefaultDownloadHandler(this.data.classes));
178+
return await this.model.save(handlerOrURL || getDefaultDownloadHandler(this.data.classes), params);
180179
}
181180
}
182181

0 commit comments

Comments
 (0)