teachablemachine-community
teachablemachine-community copied to clipboard
[BUG]: tmImage doesn't work and throws an error around fetch()
Describe the bug The goal is to create nodejs client, which will make predictions based on the model, generated by TM
However, it's not possible to use tmImage()
To Reproduce Steps to reproduce the behavior:
const tmImage = require('@teachablemachine/image');
const URL = 'https://teachablemachine.withgoogle.com/models/NujXJZDb4/';
async function init() {
const modelURL = URL + 'model.json';
const metadataURL = URL + 'metadata.json';
model = await tmImage.load(modelURL, metadataURL);
console.log('works')
}
init();
Stack trace:
ReferenceError: fetch is not defined
at /Users//Desktop/img/node_modules/@teachablemachine/image/dist/custom-mobilenet.js:153:17
at step (/Users//Desktop/img/node_modules/@teachablemachine/image/dist/custom-mobilenet.js:49:23)
at Object.next (/Users//Desktop/img/node_modules/@teachablemachine/image/dist/custom-mobilenet.js:30:53)
at /Users//Desktop/img/node_modules/@teachablemachine/image/dist/custom-mobilenet.js:24:71
at new Promise (
Expected behavior The function works w/o errors
@tadvas did you find a way to get this working in nodejs? If not, did you find another solution?