From f9d8ab98832fae5d5b605347b0c8713f88e732b6 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 8 May 2024 17:58:34 -0400 Subject: [PATCH] Fix --- structures/Tensorflow.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/structures/Tensorflow.js b/structures/Tensorflow.js index fd4d1cb0..218e18ad 100644 --- a/structures/Tensorflow.js +++ b/structures/Tensorflow.js @@ -3,6 +3,7 @@ const nsfw = require('nsfwjs'); const faceDetection = require('@tensorflow-models/face-detection'); const faceModel = faceDetection.SupportedModels.MediaPipeFaceDetector; const path = require('path'); +const url = require('url'); module.exports = class Tensorflow { constructor(client) { @@ -27,14 +28,16 @@ module.exports = class Tensorflow { } async loadStyleModel() { - const model = await tf.loadGraphModel(path.join(__dirname, '..', 'tf_models', 'style_js', 'model.json')); + const model = await tf.loadGraphModel( + url.pathToFileURL(path.join(__dirname, '..', 'tf_models', 'style_js', 'model.json')).href + ); this.styleModel = model; return this.styleModel; } async loadTransformerModel() { const model = await tf.loadGraphModel( - path.join(__dirname, '..', 'tf_models', 'transformer_separable_js', 'model.json') + url.pathToFileURL(path.join(__dirname, '..', 'tf_models', 'transformer_separable_js', 'model.json')).href ); this.transformerModel = model; return this.transformerModel;