Skip to content

Commit

Permalink
use modelId as arg
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed May 9, 2017
1 parent b7a78d7 commit 8593a06
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions www/tensorflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function loadModel(modelId, callback, errorCallback, progressCallback) {
};
}
if (!model.cached) {
checkCached(model, function(cached) {
checkCached(modelId, function(cached) {
if (!cached) {
fetchModel(
model,
Expand Down Expand Up @@ -195,7 +195,14 @@ function fetchModel(model, callback, errorCallback, progressCallback) {
fetchZip(model, callback, errorCallback, progressCallback);
}

function checkCached(model, callback, errorCallback) {
function checkCached(modelId, callback, errorCallback) {
var model;
try {
model = getModel(modelId);
} catch (e) {
errorCallback(e);
return;
}
var zipUrl = model.model_path.split('#')[0];
if (model.label_path.indexOf(zipUrl) == -1) {
errorCallback('Model and labels must be in same zip file!');
Expand Down

0 comments on commit 8593a06

Please sign in to comment.