Skip to content

Commit

Permalink
Merge pull request #84 from ml5js/fix-neruralNetwork-load-model-topol…
Browse files Browse the repository at this point in the history
…ogy-mismatch

Fix nerural network load model topology mismatch
  • Loading branch information
shiffman authored Mar 6, 2024
2 parents 512d143 + 918cf61 commit 7d3e053
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/NeuralNetwork/NeuralNetwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class NeuralNetwork {
const modelJsonResult = await axios.get(filesOrPath.model, {
responseType: "text",
});
const modelJson = JSON.stringify(modelJsonResult.data);
const modelJson = modelJsonResult.data;
// TODO: browser File() API won't be available in node env
const modelJsonFile = new File([modelJson], "model.json", {
type: "application/json",
Expand Down
8 changes: 2 additions & 6 deletions src/NeuralNetwork/NeuralNetworkData.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,13 +836,9 @@ class NeuralNetworkData {
} else if (filesOrPath instanceof Object) {
// filesOrPath = {model: URL, metadata: URL, weights: URL}

let modelMetadata = await axios.get(filesOrPath.metadata, {
responseType: "text",
});
modelMetadata = JSON.stringify(modelMetadata.data);
modelMetadata = JSON.parse(modelMetadata);
let metadataResult = await axios.get(filesOrPath.metadata);

this.meta = modelMetadata;
this.meta = metadataResult.data;
} else {
const metaPath = `${filesOrPath.substring(
0,
Expand Down

0 comments on commit 7d3e053

Please sign in to comment.