Skip to content

Commit

Permalink
Add 'main' method
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Morawiec committed Nov 14, 2017
1 parent 9fdcc49 commit dd70ac7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def export(self, class_name, method_name,

temp_class = self.temp('exported.class')
return temp_class.format(class_name=self.class_name,
method_name=self.method_name)
method_name=self.method_name,
n_features=self.n_features)

# Deep embedded data:
method = self.create_method_embedded()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,21 @@ var {class_name} = function(jsonFile) {{
}});
}};

}};
}};

if (typeof process !== 'undefined' && typeof process.argv !== 'undefined') {{
if (process.argv.length - 2 === {n_features}) {{

// Features:
var features = process.argv.slice(2);

// Estimator and parameters:
var clf = new {class_name}('http://localhost:8000/data.json');

// Prediction:
clf.{method_name}(features).then(function(prediction) {{
console.log(prediction);
}});

}}
}}

0 comments on commit dd70ac7

Please sign in to comment.