Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -8,6 +8,7 @@ const axios = require("axios")
|
|
| 8 |
const FormData = require("form-data")
|
| 9 |
const tfjs = require('@tensorflow/tfjs-node')
|
| 10 |
const nsfwjs = require('nsfwjs')
|
|
|
|
| 11 |
//const { BingChat } = (await import("bing-chat")).default
|
| 12 |
const apikey = "@SadTeam77"
|
| 13 |
|
|
@@ -339,7 +340,7 @@ async function check_nsfw(buffer) {
|
|
| 339 |
const model = await nsfwjs.load() // To load a local model, nsfw.load('file://./path/to/model/')
|
| 340 |
const convert = async (img) => {
|
| 341 |
// Decoded image in UInt8 Byte array
|
| 342 |
-
const image = await
|
| 343 |
|
| 344 |
const numChannels = 3
|
| 345 |
const numPixels = image.width * image.height
|
|
|
|
| 8 |
const FormData = require("form-data")
|
| 9 |
const tfjs = require('@tensorflow/tfjs-node')
|
| 10 |
const nsfwjs = require('nsfwjs')
|
| 11 |
+
const jpegjs = require('jpeg-js')
|
| 12 |
//const { BingChat } = (await import("bing-chat")).default
|
| 13 |
const apikey = "@SadTeam77"
|
| 14 |
|
|
|
|
| 340 |
const model = await nsfwjs.load() // To load a local model, nsfw.load('file://./path/to/model/')
|
| 341 |
const convert = async (img) => {
|
| 342 |
// Decoded image in UInt8 Byte array
|
| 343 |
+
const image = await jpegjs.decode(img, { useTArray: true })
|
| 344 |
|
| 345 |
const numChannels = 3
|
| 346 |
const numPixels = image.width * image.height
|