Merge branch 'main' into frontend-multilingual up to commit 0aa8a3842c
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
package-lock.json
|
||||||
|
node_modules/
|
||||||
@@ -2,7 +2,7 @@ const multer = require("multer");
|
|||||||
|
|
||||||
const storage = multer.diskStorage({
|
const storage = multer.diskStorage({
|
||||||
destination: function (req, file, cb) {
|
destination: function (req, file, cb) {
|
||||||
cb(null, "./public/images");
|
cb(null, "./uploads");
|
||||||
},
|
},
|
||||||
|
|
||||||
filename: function (req, file, cb) {
|
filename: function (req, file, cb) {
|
||||||
|
|||||||
Generated
+732
-3493
File diff suppressed because it is too large
Load Diff
+11
-14
@@ -10,23 +10,20 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "",
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google/generative-ai": "^0.22.0",
|
"@google/generative-ai": "^0.24.1",
|
||||||
"@huggingface/transformers": "^3.3.3",
|
"bcrypt": "^6.0.0",
|
||||||
"@xenova/transformers": "^2.17.2",
|
"cloudinary": "^2.7.0",
|
||||||
"bcrypt": "^5.1.1",
|
"cookie-parser": "^1.4.7",
|
||||||
"cloudinary": "^2.5.1",
|
|
||||||
"cookie-parser": "^1.4.6",
|
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.5.0",
|
||||||
"express": "^4.19.2",
|
"express": "^5.1.0",
|
||||||
"jimp": "^1.6.0",
|
|
||||||
"jsonwebtoken": "^9.0.2",
|
"jsonwebtoken": "^9.0.2",
|
||||||
"mongoose": "^8.6.1",
|
"mongoose": "^8.16.0",
|
||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^2.0.1",
|
||||||
"nodemailer": "^6.9.15",
|
"nodemailer": "^7.0.3",
|
||||||
"socket.io": "^4.7.5"
|
"socket.io": "^4.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.1.4"
|
"nodemon": "^3.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const Ai = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className="min-h-screen w-full flex items-center justify-center max-h-screen">
|
||||||
<div className="max-w-md mx-auto p-6 bg-white shadow rounded-lg">
|
<div className="max-w-md mx-auto p-6 bg-white shadow rounded-lg">
|
||||||
<h2 className="text-2xl font-bold mb-4 text-center">
|
<h2 className="text-2xl font-bold mb-4 text-center">
|
||||||
Plant disease prediction
|
Plant disease prediction
|
||||||
@@ -72,6 +73,7 @@ const Ai = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const AddFarm = () => {
|
|||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
setIsModalOpen(false);
|
setIsModalOpen(false);
|
||||||
window.location.reload();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err.message);
|
setError(err.message);
|
||||||
setSuccess(false);
|
setSuccess(false);
|
||||||
|
|||||||
+16
-1
@@ -3,10 +3,19 @@ const express = require("express");
|
|||||||
const { spawn } = require("child_process");
|
const { spawn } = require("child_process");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const upload = require("./Middleware/multer");
|
const upload = require("./Middleware/multer");
|
||||||
|
const cors = require("cors");
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = 3000;
|
const PORT = 3000;
|
||||||
|
|
||||||
|
const corsOptions = {
|
||||||
|
origin: "http://localhost:5173",
|
||||||
|
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||||
|
credentials: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
app.use(cors(corsOptions));
|
||||||
|
|
||||||
// Endpoint to run the Python script
|
// Endpoint to run the Python script
|
||||||
app.post("/predict", upload.single("image"), (req, res) => {
|
app.post("/predict", upload.single("image"), (req, res) => {
|
||||||
console.log("File is uploaded successfully" + req.file?.path);
|
console.log("File is uploaded successfully" + req.file?.path);
|
||||||
@@ -22,7 +31,13 @@ app.post("/predict", upload.single("image"), (req, res) => {
|
|||||||
// Collect data from the script
|
// Collect data from the script
|
||||||
pythonProcess.stdout.on("data", (data) => {
|
pythonProcess.stdout.on("data", (data) => {
|
||||||
console.log(`Output: ${data}`);
|
console.log(`Output: ${data}`);
|
||||||
res.send(data.toString()); // Send the output back to the client
|
|
||||||
|
res.status(200).json({
|
||||||
|
success: true,
|
||||||
|
message: "Image uploaded successfully",
|
||||||
|
data: data.toString(),
|
||||||
|
});
|
||||||
|
//res.send(data.toString()); // Send the output back to the client
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle errors
|
// Handle errors
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"apexcharts": "^3.46.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user