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.89k stars 363 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 6 months ago

streetheroesru commented 6 months 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 5 months ago

I have the same issue.