Replies: 5 comments
-
@benmussi @rizkiramadhanx taking a look at this and trying to reproduce. Which of the examples are you referencing? Do you have any other relevant information to provide? |
Beta Was this translation helpful? Give feedback.
-
i have the same problem i need to load model locally and classify images locally on my pc to batch process how can i do that? a simple code would be amazing |
Beta Was this translation helpful? Give feedback.
-
I managed to make the wasm model work in nodejs. Was a pain.
You have to return something like this
|
Beta Was this translation helpful? Give feedback.
-
Works for me on bun and node: root/
├── public/
│ └── nsfwjs/
│ ├── group1-shard1of2
│ ├── group1-shard2of2
│ └── model.json
import * as tf from "@tensorflow/tfjs-node";
import * as nsfwjs from "nsfwjs";
let nsfwModel: nsfwjs.NSFWJS | null = null;
export async function loadNSFWModel() {
try {
tf.enableProdMode();
nsfwModel = await nsfwjs.load("file://./public/nsfwjs/", { type: "graph" });
} catch (error) {
console.error("Failed to load NSFW model:", error);
}
} |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am using NSFW JS on a Node JS application - (https://github.com/infinitered/nsfwjs#node-js-app)
Per the instructions, I can properly load the model using:
const model = await nsfw.load();
However, instead of using the default model on the S3 bucket, I would like to store the model locally and so I have saved the model files locally in a folder with a relative path of ./model/
I tried multiple ways of loading the locally stored model without success and could use help, please. Per the instructions, I tried 3 different ways:
const model = await nsfw.load("file://./model/");
==> This resulted in the error "Only HTTP(S) protocols are supported"
const model = await nsfw.load("file://" + __dirname + "/model/");
==> This resulted in the error "Only absolute URLS are supported"
const model = await nsfw.load("file://c/:\\Users\\User\\NSFWJS\\model");
==> This resulted in the error "Only absolute URLS are supported"
Can anyone provide a suggestion? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions