Removed test2.js, not req.

This commit is contained in:
K
2025-07-23 01:46:41 +05:30
parent 30464136a3
commit 0003858e3a
-31
View File
@@ -1,31 +0,0 @@
import { pipeline } from "@xenova/transformers";
import Jimp from "jimp";
async function main() {
const modelName = "Xenova/distilbert-base-uncased-finetuned-sst-2-english"; // Example model
// Load the model
const classifier = await pipeline("image-classification", modelName);
// Load the image
let image;
try {
image = await Jimp.read("/home/karan/Downloads/tomato.png");
image.rgba(true);
} catch (error) {
console.error("Error: Unable to open image. Check the file type or path.");
console.error(error);
return;
}
// Convert image to buffer
const buffer = await image.getBufferAsync(Jimp.MIME_PNG);
// Classify the image
const result = await classifier(buffer);
console.log("Predicted class:", result);
}
main().catch(console.error);