Skip to content

Commit

Permalink
Merge pull request #44 from SLIIT-24-25J-047-Research/IT21319792-Bosh…
Browse files Browse the repository at this point in the history
…itha_Gunarathna

It21319792 boshitha gunarathna
  • Loading branch information
BoshithaMGunarathna authored Nov 29, 2024
2 parents 06de44a + 9813208 commit 59863a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const FormData = require('form-data');
const fs = require('fs');
const path = require('path');
const ffmpeg = require('fluent-ffmpeg'); // Import fluent-ffmpeg
const Prediction = require('../models/candidate/Prediction');
// const Prediction = require('../models/candidate/Prediction');

exports.predictConfidence = async (req, res) => {
try {
Expand Down Expand Up @@ -49,12 +49,7 @@ exports.predictConfidence = async (req, res) => {

console.log('Flask response:', flaskResponse.data); // Log Flask response

// Save prediction in the database
const newPrediction = new Prediction({
email: req.body.email,
prediction: flaskResponse.data.prediction
});
await newPrediction.save();


// Clean up the temporary converted audio file
fs.unlink(tempFilePath, (err) => {
Expand All @@ -67,7 +62,7 @@ exports.predictConfidence = async (req, res) => {

return res.status(200).json({
success: true,
prediction: flaskResponse.data.prediction
prediction: flaskResponse.data
});
} catch (error) {
console.error('Error in Flask response:', error.message);
Expand Down
2 changes: 1 addition & 1 deletion backend/routes/voiceConfidenceRoutes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const express = require('express');
const multer = require('multer');
const path = require('path');
const { predictConfidence } = require('../controllers/predictController');
const { predictConfidence } = require('../controllers/confidencePredictController');

const router = express.Router();
const storage = multer.diskStorage({
Expand Down

0 comments on commit 59863a8

Please sign in to comment.