Trying to fetch image from axios.
pprathameshmore opened this issue · 0 comments
pprathameshmore commented
I am trying to fetch images from Axios as arraybuffer
function getImage() {
const { data } = await axios.get(url, { responseType: "arraybuffer" });
return data;
}
const image = await getImage();
const modal = await nsfw.load();
const decodedImage = await tf.node.decodeImage(image);
const predictions = await modal.classify(decodedImage);
decodedImage.dispose();
But this code throws an error.
Error: Expected image (BMP, JPEG, PNG, or GIF), but got unsupported image type