diff --git a/src/NeuralNetwork/NeuralNetwork.js b/src/NeuralNetwork/NeuralNetwork.js index 9dcbf2ba..faabf94f 100644 --- a/src/NeuralNetwork/NeuralNetwork.js +++ b/src/NeuralNetwork/NeuralNetwork.js @@ -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", diff --git a/src/NeuralNetwork/NeuralNetworkData.js b/src/NeuralNetwork/NeuralNetworkData.js index 6d8f1cde..ad851afc 100644 --- a/src/NeuralNetwork/NeuralNetworkData.js +++ b/src/NeuralNetwork/NeuralNetworkData.js @@ -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,