Changed port and origin url+methods allowed in models/server.js

This commit is contained in:
K
2025-07-22 16:42:04 +05:30
parent ccd5debcef
commit 45419247f7
+4 -4
View File
@@ -6,11 +6,11 @@ const upload = require("./Middleware/multer");
const cors = require("cors"); const cors = require("cors");
const app = express(); const app = express();
const PORT = 3000; const PORT = 8081;
const corsOptions = { const corsOptions = {
origin: "http://localhost:5173", origin: "http://frontend:3000",
methods: "GET,HEAD,PUT,PATCH,POST,DELETE", methods: "GET,PUT,POST",
credentials: true, credentials: true,
}; };
@@ -26,7 +26,7 @@ app.post("/predict", upload.single("image"), (req, res) => {
console.log("Image Path is : ", imagePath); console.log("Image Path is : ", imagePath);
// Spawn a new Python process // Spawn a new Python process
const pythonProcess = spawn("python", ["app.py", imagePath]); const pythonProcess = spawn("python3", ["app.py", imagePath]);
// Collect data from the script // Collect data from the script
pythonProcess.stdout.on("data", (data) => { pythonProcess.stdout.on("data", (data) => {