Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mrahmatu committed Nov 13, 2023
2 parents dc49657 + dd78495 commit d3669ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion public/src/modules/helpers.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ module.exports = function (utils, Benchpress, relative_path) {
}

function getPredictionColor(prediction) {
if (prediction === 1) { return `"background-color: rgb(0, 255, 0);"`; }
if (prediction === '1') { return `"background-color: rgb(0, 255, 0);"`; }
return `"background-color: rgb(255, 0, 0);"`;
}

Expand Down
13 changes: 12 additions & 1 deletion src/controllers/write/career.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ Career.register = async (req, res) => {
num_past_internships: userData.num_past_internships,
};

userCareerData.prediction = Math.round(Math.random()); // TODO: Change this line to do call and retrieve actual candidate success prediction from the model instead of using a random number
try {
// deployed url for the microservice
const deployedUrl = 'https://python-microservice-f474tbkenq-uc.a.run.app/predict';
// sending http request to the url
const params = new URLSearchParams(userCareerData);
const response = await fetch(`${deployedUrl}?${params}`);
const data = await response.json();
// getting the prediction based on the response from the http request
userCareerData.prediction = String(data.good_employee);
} catch (error) {
console.error('Error while making the HTTP request:', error);
}

await user.setCareerData(req.uid, userCareerData);
db.sortedSetAdd('users:career', req.uid, req.uid);
Expand Down

0 comments on commit d3669ce

Please sign in to comment.