如果是,请提供一些链接,否则请告诉我原因
我已经下载了翻译模型,然后尝试使用库“@xenova/transformers”,它无法加载模型进行测试,因为我的模型扩展类似于 model.gguf
您可以使用 Node.js 中现有的“translatte”模块。这是与这个开源库相关的链接:
一般步骤:
第一步:在终端中写入“npm install translatte”或“npm i translatte”。
第二步:您可以将translate()函数与try-catch资源一起使用,如下代码:
const wordToBeTranslated = "Hello Universe!";
translatte(wordToBeTranslated, { to: "fr" }).then(response => {
console.log(`The French translation of the word ${wordToBeTranslated} is ${response.text}`);
}).catch((err) => {
throw err;
});