-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NSFW through Docker reports an error - maybe provide Docker support? #859
Comments
Steps to reproduce the error in a Docker container: We can launch a new, empty container for it:
Now, we can install the project dependencies, as defined in the README - Node JS App section (please note that the Docker container gives us access as the
Then, we can install VIM (or Nano, or any other editor) to create the sample file:
And now we can add the sample content to the file:
const axios = require("axios"); //you can use any http client
const tf = require("@tensorflow/tfjs-node");
const nsfw = require("nsfwjs");
async function fn() {
const pic = await axios.get(`https://via.placeholder.com/250x135`, {responseType: "arraybuffer"});
const model = await nsfw.load(); // To load a local model, nsfw.load('file://./path/to/model/')
// Image must be in tf.tensor3d format
// you can convert image to tf.tensor3d with tf.node.decodeImage(Uint8Array,channels)
const image = await tf.node.decodeImage(pic.data, 3);
const predictions = await model.classify(image);
image.dispose(); // Tensor memory must be managed explicitly (it is not sufficient to let a tf.Tensor go out of scope for its memory to be released).
console.log(predictions);
}
fn(); Finally, we can run the logic:
And, definitely, we can confirm the "missing" file actually exists:
|
Good day,
I have tried to use this library through a Docker container, but it seems to fail.
My setup includes AMQP + MariaDB so
{"file_id":"12345"}
) andSELECT path FROM files WHERE id = ?
)If I run the source code locally (on my host machine) the process seems to work as expected:
However, if I try to run the same logic through Docker, then it seems to have problems loading the
node_modules
dependencies:Do you have any suggestions?
== EDIT ==
I can confirm the "non-existing" file exists:
The text was updated successfully, but these errors were encountered: