imgly / background-removal-js

Remove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns. Explore an interactive demo.
https://img.ly/showcases/cesdk/web/background-removal/web
GNU Affero General Public License v3.0
5.49k stars 337 forks source link

Failed to create session: "RangeError: offset is out of bounds". Please check if the publicPath is set correctly. #123

Open streetheroesru opened 1 month ago

streetheroesru commented 1 month ago

Cannot pass image to removeBackground Function:

    axios
      .get('/images/user.jpeg', {
        responseType: 'arraybuffer',
      })
      .then(async (response) => {
        const buffer = Buffer.from(response.data, 'base64')

        const blob = await removeBackground(buffer, {
          device: 'cpu',
        })
        console.log(blob)
      })

Error:

index.mjs:5951 Uncaught (in promise) Error: Failed to create session: "RangeError: offset is out of bounds". Please check if the publicPath is set correctly.
    at eval (index.mjs:5951:13)
    at async createOnnxSession (index.mjs:5949:19)
    at async initBase (index.mjs:6143:19)
    at async initInference (index.mjs:6148:16)

What am i doing wrong?

roshanaale9818 commented 3 weeks ago

I have the same issue.