infinitered / nsfwjs

NSFW detection on the client-side via TensorFlow.js
https://nsfwjs.com/
MIT License
7.89k stars 524 forks source link

Is it possible to run NSFW.js on Cloudflare? #868

Open ambrt opened 1 month ago

ambrt commented 1 month ago

I'm seeking a cloud host for NSFW.js and wonder if Cloudflare Workers can do it.

Can anyone share some experience?

L4Ph commented 1 month ago

I'm not sure how long my motivation will last, but I'm creating something like this now. https://github.com/L4Ph/nsfwts

Furthermore, in the project I'm contributing to, I've implemented it as follows and confirmed it's working on Remix (Cloudflare Pages). https://github.com/aipictors/aipictors/blob/fd1adf889a8ea8ffa820f9e9bdde166f3ae43d60/app/routes/(%24lang).debug.nsfw/route.tsx https://github.com/aipictors/aipictors/pull/560

While the performance might depend on the CPU and memory available, I believe there's a high possibility that it can run on Cloudflare Workers since it's WASM (WebAssembly).

ambrt commented 1 week ago

I might try and see.

I wonder if 128MB ram of worker would be enough.