mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Update Font system
This commit is contained in:
@@ -8,18 +8,17 @@ module.exports = class Tensorflow {
|
||||
constructor(client) {
|
||||
Object.defineProperty(this, 'client', { value: client });
|
||||
|
||||
this.nsfwModel = null;
|
||||
this.faceModel = faceDetection.SupportedModels.MediaPipeFaceDetector;
|
||||
this.nsfwjs = null;
|
||||
this.faceDetector = null;
|
||||
}
|
||||
|
||||
async loadNSFWModel() {
|
||||
const nsfwModel = await nsfw.load(
|
||||
async loadNSFWJS() {
|
||||
const nsfwjs = await nsfw.load(
|
||||
`${url.pathToFileURL(path.join(__dirname, '..', 'tf_models', 'nsfw', 'web_model')).href}/`,
|
||||
{ type: 'graph' }
|
||||
);
|
||||
this.nsfwModel = nsfwModel;
|
||||
return this.nsfwModel;
|
||||
this.nsfwjs = nsfwjs;
|
||||
return this.nsfwjs;
|
||||
}
|
||||
|
||||
async loadFaceDetector() {
|
||||
@@ -42,7 +41,7 @@ module.exports = class Tensorflow {
|
||||
|
||||
async isImageNSFW(image, bool = true) {
|
||||
const img = await tfnode.node.decodeImage(image, 3);
|
||||
const predictions = await this.nsfwModel.classify(img);
|
||||
const predictions = await this.nsfwjs.classify(img);
|
||||
img.dispose();
|
||||
if (bool) {
|
||||
const results = [];
|
||||
|
||||
Reference in New Issue
Block a user