From 0003858e3abdd55f70c05baf6d13adfe11d5355b Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 23 Jul 2025 01:46:41 +0530 Subject: [PATCH] Removed test2.js, not req. --- Backend/test2.js | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 Backend/test2.js diff --git a/Backend/test2.js b/Backend/test2.js deleted file mode 100644 index 2636a4a..0000000 --- a/Backend/test2.js +++ /dev/null @@ -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); -