Open tariwiencke opened 9 months ago
Exactly the same using same NextJs version.
Moved /dist/*
to /public/models
and /dist/resources.json
to /public
.
Loading models finished successful, but right after getting
Uncaught (in promise) Error: Resource onnxruntime-web/ort-wasm-simd.wasm not found. Ensure that the config.publicPath is configured correctly. loadAsBlob index.mjs:5891 loadAsUrl index.mjs:5878 createOnnxSession index.mjs:6039 initInference index.mjs:9859 memoized index.mjs:4228 removeBackground index.mjs:9914
async function processImage(image) {
const blob = await removeBackground(image, {
publicPath: `${new URL(window.location.toString()).origin}/models/`,
model: 'small',
debug: true,
progress: (key, value, total) => {
console.log(`${key}: ${value}/${total}`);
},
});
const buffer = await blob.arrayBuffer();
...
}
I also encountered this problem, and then I read the source code and found the problem. The key in resource.json was /onnxruntime-web/ort-wasm-simd.wasm
, but loadAsUrl('onnxruntime-web/ort -wasm-simd.wasm', config)
is missing /
. I changed the source code to skip this error, but encountered WebAssembly.instantiate(): Import #37 module="a" function="L" error: function import requires a callable)
This error, do you have any solution to this error?
Same problem here.
it looks like its a problem in the https://unpkg.com/ hosting . https://classic.yarnpkg.com/en/package/@imgly/background-removal-node
I build this little function to remove the background of an image from file input. Build with Next.js 13.5.4.
When running with chrome I get this error:
When I leave out the publicPath in the config like this...
I receive this error:
The model then gets fetched from this url: