Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -341,8 +341,8 @@ async function check_nsfw(buffer) {
|
|
| 341 |
// you can convert image to tf.tensor3d with tf.node.decodeImage(Uint8Array,channels)
|
| 342 |
const image = await tfjs.node.decodeImage(buffer,3)
|
| 343 |
const predictions = await model.classify(image)
|
| 344 |
-
image.dispose()
|
| 345 |
-
|
| 346 |
return {
|
| 347 |
class_name: v.className,
|
| 348 |
probability: v.probability,
|
|
|
|
| 341 |
// you can convert image to tf.tensor3d with tf.node.decodeImage(Uint8Array,channels)
|
| 342 |
const image = await tfjs.node.decodeImage(buffer,3)
|
| 343 |
const predictions = await model.classify(image)
|
| 344 |
+
image.dispose();
|
| 345 |
+
const results = prediction.map(v => {
|
| 346 |
return {
|
| 347 |
class_name: v.className,
|
| 348 |
probability: v.probability,
|