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.7k stars 357 forks source link

Examples click me error #9

Open rick-liruixin opened 1 year ago

rick-liruixin commented 1 year ago

Uncaught (in promise) Error: Failed to fetch medium with size 88188479 but got 133 at bundle.ts:98:11

DanielHauschildt commented 1 year ago

This happens when for some reason the received asset has wrong size. Maybe there is a rate limit on unpkg?

DanielHauschildt commented 1 year ago

Does it still not work?

rick-liruixin commented 1 year ago

Where should I cancel? @DanielHauschildt

DanielHauschildt commented 1 year ago

What do you mean by "cancel"?

Have you tried to host the assets on a custom server? For some reason I cannot reproduce the error.

DanielHauschildt commented 1 year ago

It could be a cors error. Ensure that for local development you are using localhost and not the ip based url

delta42 commented 1 year ago

I had the same issue while playing with the create-react-app sample. For starters LFS failed during git clone, I think this repo may just be out of allocated bandwidth, which might explain why the GitHub Actions are failing.

Then unpkg was flaky. Sometimes I could download a file, sometimes I got a 502 Bad Gateway, sometimes it just timed out.

I solved the problem by (painstakingly) downloading the 2 ONNX files and 6 WASM from https://www.unpkg.com/browse/@imgly/background-removal@1.0.6/dist/ and placing them in examples\create-react-app\public\static\js.

Hope this helps.

DanielHauschildt commented 1 year ago

Do you know a cdn where I could host the models for free which is more stable?

delta42 commented 1 year ago

My first thought was jsDelivr but they have a 20MB per file size limit. although they make it seem like they could allow exceptions, might be worth attempting to get this "small" exception.

Packages larger than 50 MB or single files larger than 20 MB (in case of GitHub) are not supported by default. We recommend removing files that are not needed from your package when possible. If you need to set a higher limit for your package, open an issue in this repo.

https://www.jsdelivr.com/documentation

Maybe using Cloudfare directly could work? They seem to have the most generous free offering out there.

https://developers.cloudflare.com/workers/platform/limits

zrl2088 commented 8 months ago

I have the same problem; Uncaught (in promise) Error: Failed to fetch /models/medium with size 4194304 but got 0; I set up a local file server that can be accessed and the model can be downloaded, but it just prompts this error. There is no problem with the downloaded file. image image Please help me find out what the problem is and how to solve it.

AliYar-Khan commented 7 months ago

@DanielHauschildt facing the same issue. I even added the fetch args

fetchArgs: { mode: 'no-cors' }

but this didn't help